Boost logo

Boost :

Subject: Re: [boost] [multi_index] Taking advantage of C++17 auto template params to simplify key specification
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2017-09-27 20:22:02


AMDG

On 09/27/2017 01:14 PM, Joaquin M López Muñoz via Boost wrote:
> El 27/09/2017 a las 19:15, Steven Watanabe via Boost escribió:
>> To make them be the same type, the best way is
>> to reverse it so that member, const_mem_fun, etc.
>> are aliases for key.
>
> Nice idea, but alas not applicable here since I want member etc. to
> remain C++03 compatible.
> Another approach would be to write a template<auto Member> struct
> key_impl{using type=...;}
> metafunction class here all the partial specialization goes and then do
> template<auto Member> using key=typename key_impl<Member>::type. Either
> way,
> the issue raised by Dominique does not cause any trouble AFAICS.
>

That has the disadvantage that Member can't be deduced.

template<auto Member>
void f(key<Member>); // Nope, sorry.

In Christ,
Steven Watanabe


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