CPP template parameter specified as some kind of std::function

I have a class:

<template class F>
class test
{
public:
    test(F fn) : fn_(fn)
    {
    
    }
private:
    F fn_;
};


I want to specify F as std::function, for example F can be std::function < void () >. But there can be many kinds of std::function, such as std::function < int () >. I just want to limit F to std::function. How do I write it without further specific restrictions?

CPP
Jun.14,2022

template<typename F>
class Test
{
public:
    typedef std::function<F> func_type;

    Test(const func_type& fn)
        : _fn(fn)
    {}

    template<typename ...Args>
    auto operator ()(Args&& ...args)
    {
        return _fn(std::forward<Args>(args)...);
    }

private:
    func_type _fn;
};


int main() {
    std::function<void(const std::string&)> print = [](const std::string& name) {
        std::cout << "Hello " << name << " !" << std::endl;
    };

    Test<void(const std::string&)> t(print);

    t("Jason");

    return 0;
}

take a look, isn't it?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3fb22-2c4e0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3fb22-2c4e0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?