Daryle Walker ha escrito:
> But doesn't the "PtrToMember" template parameter already imply the > "Type" and "Class" parameters? So specifying all three would be > redundant. Could we reduce it by: > > //================================================================ > template < typename PtrToMember > > struct member_extractor > { > // Don't know if this is a real type-traits class > BOOST_STATIC_ASSERT(is_pointer_data_member<PtrToMember>::value); > > // The extractor traits classes aren't real (yet, maybe) > typedef get_class_type<PtrToMember> argument_type; > typedef get_member_type<PtrToMember> return_type; > > return_type const & operator ()( argument_type const &c ) const > { return c.*PtrToMember; } > > return_type & operator ()( argument_type &c ) const > { return c.*PtrToMember; } > }; Of the approaches you propose, this is the one that I like best, but I'm afraid it cannot be implemented: Note that PtrToMember is a *type* (something like int A::*), not a pointer to member. member_extractor would have to defined as template < typename PtrToMember, PtrToMember ptr > struct member_extractor and used as member_extractor<int A::*,&A::x>; // x is an int member of A which takes us again to the redundancy we were trying to avoid. Something in the way of eliminating this redundancy, however, would be a boon. Maybe some metaprogramming gurus here can think of something. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost