c++ - Can someone explain this template function declaration syntax -


i not understand following template declaration in boost::python library (line 47 of .../boost_1_51/boost/python/detail/msvc_typeinfo.hpp precise):

template< typename t > t&(* is_ref_tester1(type<t>) )(type<t>) { return 0; } 

where type template <class t> struct type {};

it seems functionally equivalent to:

template<typename t> struct func_type_getter {     typedef t&(*func_type)(type<t>); };   template< typename t > typename func_type_getter<t>::func_type is_ref_tester1(type<t>) { return 0; } 

are these equivalent, shorthand, or can explain differences?

yes, 2 equivalent. here is, how one-liner read:

template< typename t > t&(* is_ref_tester1(type<t>) )(type<t>) { return 0; }                        ^           ^        ^            ^                        |           |        |            |                        |           |        |     3. it's return type pointer function taking type<t>                        |           |        |                        |           |    2. it's function taking type<t>                        |           |                        |   1. declared identifier                        |          4. return type of function pointer returned 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -