Boost logo

Boost :

Subject: Re: [boost] SFINAE yes_type and no_type
From: Edward Diener (eldiener_at_[hidden])
Date: 2011-04-16 09:55:36


On 4/15/2011 11:13 AM, Jeroen Habraken wrote:
> Hi,
>
> Is there a specific yes_type and no_type inside boost that I should be
> using when writing a SFINAE test? There seem to be quite a few defined
> already and reinventing the wheel (albeit it being trivial) again
> doesn't make sense.

For the Boost developer there is:

#include <boost/type_traits/detail/yes_no_type.hpp>

you then have:

::boost::type_traits::yes_type
::boost::type_traits::no_type

Of course the intention of 'detail' for a library is that the code
should only be used by that library, but I think, in this case, it is
allowable for other Boost library developers to use it also.

But since this is a part of type traits detail it is not meant to be
used outside of a Boost library ( ie. by end-users ).

It would perhaps be better if ::boost::type_traits::yes_type and
::boost::type_traits::no_type were put into its own utility classes to
make it more apparent that Boost library developers and end-users of
Boost could use it.

OTOH it might be presumptuous of me to suggest that it be used at all
outside of type traits, but I have used it in my own TTI sandbox library
anyway since type traits itself is used heavily there.


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