Boost logo

Boost :

Subject: Re: [boost] [TTI] macro to "box" types for subsequent traits extraction?
From: Edward Diener (eldiener_at_[hidden])
Date: 2014-05-06 20:03:59


On 5/5/2014 11:03 AM, Rein Halbersma wrote:
> Hi everyone, this is my first post to this mailinglist, so I hope I follow
> the proper conventions around here (yes, I did read the Discussion Policy).
>
> I have a small feature request for the Type Traits Introspection library: a
> macro BOOST_TTI_BOX_TYPE(U) that defines a class template box_type<T> with
> a nested typedef named "type" that equals T::U.
>
> Rationale: because box_type<T> is a metafunction that can be supplied to
> mpl::eval_if, this facilitates user-defined traits that extract a nested
> type U, but can fall back to a (user-defined) default type. This mimics the
> C++11 allocator_traits that also provide defaults for allocators that lack
> certain nested typedefs or other properties.
>
> Small self-contained example:
> http://coliru.stacked-crooked.com/a/76b9abf4aaf00350
>
> One could probably also define similar "boxing" macros to go along with the
> has_template and other introspection tools in TTI.
>
> Would this be considered a useful feature?

Could you look at the documentation for BOOST_TTI_MEMBER_TYPE in the
section called "Nested Types" of the TTI documentation ? I think you can
easily adapt this to the purposes of your example.


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