Filip Konvi?ka ha escrito: [...]
I use this template in my code:
template<typename T> struct get_pointer_to_member_details;
template
struct get_pointer_to_member_details { typedef Class class_type; typedef Member member_type; }; Using this, you can write (and I do) something like
template<typename MemberPointerType> struct member { MemberPointerType pMember; typedef typename get_pointer_to_member_details<MemberPointerType>::class_type class_type; typedef typename get_pointer_to_member_details<MemberPointerType>::member_type result_type;
member(MemberPointerType pMember) : pMember(pMember) {} // ... }
I wonder then, is it MSVC 8 that allows something non-standard, or is it OK? I think I tried with recent gcc as well and it worked...
Your code is fine, but it does not do what boost::multi_index::member is meant to do, namely accepting the pointer-to-member as a template parameter --rather, you're taking it as a runtime variable in construction time. Ah, I see...but duplicating the argument using a macro might work, like
Joaquín Mª López Muñoz (28.6.2007 9:49):
this:
#define MEMBER(MemPtr) member