Boost::Function: Getting a pointer to a template function
Hi! I want to use a boost::function pointer to a template function. The
template type should be determinated at the time the boost::function
object is initialized. Example:
template<class T>
inline string addNumber(T inputNumber)
{
return lexical_cast<string>(inputNumber + 2);
}
template<class numType>
inline boost::function
AMDG Hans Mull wrote:
Hi! I want to use a boost::function pointer to a template function. The template type should be determinated at the time the boost::function object is initialized. Example:
template<class T> inline string addNumber(T inputNumber) { return lexical_cast<string>(inputNumber + 2); }
template<class numType> inline boost::function
getFunction(numType number) { boost::function f; f = //Which code can I use here? If I call f() I want to call addNumber<numType>(number) }
f = static_cast
Steven Watanabe schrieb:
AMDG
Hans Mull wrote:
Hi! I want to use a boost::function pointer to a template function. The template type should be determinated at the time the boost::function object is initialized. Example:
template<class T> inline string addNumber(T inputNumber) { return lexical_cast<string>(inputNumber + 2); }
template<class numType> inline boost::function
getFunction(numType number) { boost::function f; f = //Which code can I use here? If I call f() I want to call addNumber<numType>(number) } f = static_cast
(&addNumber<numType>); In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Thank you, that helped very well! Best regards, Hans
participants (2)
-
Hans Mull
-
Steven Watanabe