I'm trying to wrap std::function
in a class with adds a readable string
of the function name to std::function
.
I did come up with this simple class (defined in header.hpp)
template <typename... Args>
class CExtended_Function
{
public:
explicit CExtended_Function(
const std::function<void(Args...)>& func_type, const std::string& func_name)
: func(func_type)
, function_name(func_name)
{
}
/// Function
const std::function<void(Args...)> func;
/// Function Name
const std::string function_name;
};
My own make function looks like this. The Idea is to pass the Function Name to the make function as a template argument. And the make function should create a std::function
instance and a std::string
instance.
(defined in header.hpp)
template <typename Func_T, typename... Args>
CExtended_Function<Args...> Make_Extended_Function()
{
std::function<void(Args...)> func(Func_T);
std::string func_name(NCommonFunctions::type_name<Func_T>());
CExtended_Function<Args...> res(func, func_name);
return res;
}
where type_name<My_Function>()
returns the name of the function as std::string_view
defined in header.hpp
template <class T>
constexpr std::string_view type_name();
However when using my make function like this
used in source.cpp
static void Test_Callback();
auto test = Make_Extended_Function<Test_Callback>();
I'm getting the error :
Symbol 'Make_Extended_Function' could not be resolved
Could you give me a hint why I'm getting this error?