Boost logo

Boost Users :

From: hongleij_at_[hidden]
Date: 2007-06-29 01:48:24


 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>



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