
15 Sep
2005
15 Sep
'05
4:57 p.m.
template <class T, T&> struct nontypeadapt;
template<class Ret, Ret (&func)()> struct nontypeadapt <Ret(), func> { typedef Ret result_type; Ret operator() () { return func(); } };
then
typeid(boost::bind(nontypeadapt<void(), func1>())) != typeid(boost::bind(nontypeadapt<void(), func2>()))
However, the signature has to be given at the call site, it's repetitive to define all specializations of nontypeadapt, and it brings more forwarding problems of it's own. Any ideas?
I think you can only pass functions with external linkage as parameters to templates, which I think it makes it unusable...
I believe that's true, yes, but it's usable nonetheless. The assembler generated by vc71 for a bind with nontypeadapt is better, too. Bruno