Boost logo

Boost :

From: Pavol Droba (droba_at_[hidden])
Date: 2003-01-07 12:04:06


If there would be voting if to put these two types in Boost, I would vote for it.
They are usuful and it is not a good practice to define them on many different places.

On Tue, Jan 07, 2003 at 04:29:55PM +0100, Terje Sletteb? wrote:
> The types yes_type and no_type (or equivalent) - that is, two types which
> are guaranteed to have different size - is used extensively for Boost type
> traits, and also in some other libraries (iterator.hpp,
> named_template_params.hpp, multi_array, Phyton and signals). Some places use
> the type traits ones (<boost/type_traits/detail/yes_no_types.hpp>), other
> define them themselves.
>
> In the type traits docs (or any other docs I've found), these aren't
> mentioned (and they are defined in the "detail"-directory, suggesting it's
> an implementation detail). Yet, other libraries use them, as well. Perhaps
> these should be documented, so they may be relied on, and other libraries
> may avoid having to define them, themselves?
>
> By the way, these are defined as char and double, respectively. Are these
> required to have different size? I haven't found that guarantee in the C++
> or C standard. Theoretically, you might have an architecture which operated
> only on values of one size, so that char and double would have the same
> size.
>
> In that case, maybe something like this could be safer:
>
> typedef char yes_type[1];
> typedef char no_type[2];
>
>
> Regards,
>
> Terje
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


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