Boost logo

Boost :

Subject: Re: [boost] [multi_index] feature proposal: member keys and typeless specification of keys
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2011-05-08 14:15:06


Den 08-05-2011 18:37, Joaquin M Lopez Munoz skrev:

>
> You can decompose a pointer to member *type* into its constituents
> easily enough (even in C++98), but when you write
>
> ordered_unique<&foo::x>
>
> the entity passed to ordered_unique is not a *type* but
> a pointer (to a member). That's why you need decltype to
> do the object-->type magic, and that's why the syntax you
> propose can't work.

Apologizes for my ignorance. The following compiles fine for me:

class Bar
{
public:
     int var;
};

template< class T, class U>
void foo( T U::* ptr )
{

}

but I see your point. What a pitty the language is a barior here.
We simply can't create a class template without adding two arguments
for the ruturn type and the class type.

Thanks for explaining. Your solution is still pretty nice.

-Thorsten


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk