|
Using function_traits: msg#00306lib.boost.user
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@xxxxxxxx> Hey! Who messed with my anti-paranoia shot? ------------------------ Yahoo! Groups Sponsor ---------------------~--> Get 128 Bit SSL Encryption! http://us.click.yahoo.com/CBxunD/vN2EAA/xGHJAA/EbFolB/TM ---------------------------------------------------------------------~-> Info: <http://www.boost.org> Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl> Unsubscribe: <mailto:boost-users-unsubscribe@xxxxxxxxxxxxxxx> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Lambda questions: 00306, Claus Rasmussen |
|---|---|
| Next by Date: | Date_Time library question...: 00306, Luc Bergeron |
| Previous by Thread: | RE: ublas::matrix sharing storage with ublas::vecto ri: 00306, Scott Sinclair |
| Next by Thread: | Re: Using function_traits: 00306, John Maddock |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |