Boost logo

Boost :

Subject: Re: [boost] Nasty compile time reflection and iteration for POD types using C++14 without macro
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2016-03-25 11:49:51


AMDG

On 03/25/2016 12:39 AM, Antony Polukhin wrote:
> 2016-03-25 2:03 GMT+03:00 Klemens Morgenstern <klemens.morgenstern_at_[hidden]>:
>
>>
>> That might also be a workaround for the REGISTER_TYPE thing in you magic
>> get, though I have to admit: I don't really get how this approach works, so
>> I don't know.
>>
>
> That won't help. I need a way to make conversion of T type to some
> non-templated class and back:
> T -> int -> T
>

  Does any C++14 compiler allow the friend
function registration hack?

template<int I>
struct id_ {};

template<int I, class T>
struct register_type {
    friend T lookup(id_<I>);
};

(I'm pretty sure that this won't work
on clang.)

> TypeIndex allows only the first part of that: T -> type_index, but does not
> allow type_index -> T
>

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