$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2007-06-28 03:49:09
Filip Konvi?ka ha escrito:
[...]
> I use this template in my code:
>
>   template<typename T>
>   struct get_pointer_to_member_details;
>
>   template<typename Class, typename Member>
>   struct get_pointer_to_member_details<Member Class::*> {
>     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.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo