Boost logo

Boost Users :

Subject: Re: [Boost-users] [MPL] implementing a "trait"?
From: John M. Dlugosz (ngnr63q02_at_[hidden])
Date: 2014-02-04 13:44:30


On 2/4/2014 12:24 PM, Rodrigo Madera wrote:
> namespace john {
> template <typename T>
> struct is_pretty : boost::false_type {};
>
> template <>
> struct is_pretty<foo> : boost::true_type {};
>
> template <>
> struct is_pretty<bar> : boost::true_type {};
>
> // ...
> }
>

That's pretty much what I started with, but it doesn't handle automatic inheritance as the
main template is used for anything not exactly specialized. And I don't like that it
would require specializing a template in another namespace, which is awkward at best.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net