|
Boost Users : |
From: Marshall Clow (marshall_at_[hidden])
Date: 2002-11-27 13:35:47
I'm trying to use the function traits to extract the return type of a template parameter,
but it's not compiling.
Any ideas what's wrong here?
-------- begin simplified code ------
template<typename Proc>
class CacheValue {
typedef boost::function_traits<Proc>::R ReturnType;
template<typename Arg1>
ReturnType operator () ( Arg1 arg1 ) { /* do something */ }
};
CacheValue<unsigned long (*) ( unsigned long )> aValue;
-------- end simplified code ------
Gets the error:
Error : illegal use of incomplete struct/union/class 'boost::detail::function_traits_helper<unsigned long (**)(unsigned long)>'
(point of instantiation: 'main()')
(instantiating: 'CacheValue<unsigned long (*)(unsigned long)>')
(instantiating: 'boost::function_traits<unsigned long (*)(unsigned long)>')
function_traits.hpp line 170 public detail::function_traits_helper<typename add_pointer<Function>::type>
Error : 'R' is not a member of class 'boost::function_traits<unsigned long (*)(unsigned long)>'
(point of instantiation: 'main()')
(instantiating: 'CacheValue<unsigned long (*)(unsigned long)>')
HelloWorld.cp line 57 CacheValue<TickGetter> ticks ( GetCount );
Environment:
MacOS 10.2.2, CodeWarrior 8.3, boost from CVS this morning.
It seems as if the "add_pointer" in function_traits_helper is messing things up.
Of course, it's more likely that I am using this wrong ;-)
Thanks in advance!
-- -- Marshall Marshall Clow Idio Software <mailto:marshall_at_[hidden]> Hey! Who messed with my anti-paranoia shot?
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net