Re: [Boost-users] [multi-index] member ar guments [Was: how to use inheritmember as index]

it my implemention, i use BOOST_TYPEOF instead of typeof(). it seems work well for gcc and vc7.1 , #include <boost/multi_index/member.hpp> //for member #include <boost/multi_index/mem_fun.hpp> //for const_mem_fun using boost::multi_index::member; using boost::multi_index::const_mem_fun; #include <boost/typeof/typeof.hpp> /* MEMBER */ template<typename T> struct get_details; template<typename Class, typename Member> struct get_details<Member Class::*> { typedef Class class_type; typedef Member member_type; }; #define MEMBER(MemPtr) \ member< \ get_details<BOOST_TYPEOF(MemPtr)>::class_type, \ get_details<BOOST_TYPEOF(MemPtr)>::member_type, \ MemPtr> /* CONST_MEM_FUN */ template<typename T> struct get_fun_details; template<typename Class, typename Type> struct get_fun_details<Type (Class::*)()const> { typedef Class class_type; typedef Type member_type; }; #define CONST_MEM_FUN(MemFunPtr) \ const_mem_fun< \ get_fun_details<BOOST_TYPEOF(MemFunPtr)>::class_type, \ get_fun_details<BOOST_TYPEOF(MemFunPtr)>::member_type, \ MemFunPtr>
participants (1)
-
hongleij@126.com