Boost logo

Boost :

From: Hartmut Kaiser (hartmutkaiser_at_[hidden])
Date: 2003-01-07 16:10:49


Terje Slettebø wrote:

> >From: "David Abrahams" <dave_at_[hidden]>
>
> > Terje Slettebø <tslettebo_at_[hidden]> writes:
> >
> > >> Sure! Submit a patch (with docs) for the utility library.
> > >
> > > Ok. Here's <boost/utility/yes_no_type.hpp>.
> > >
> > > I just used the file
> <boost/type_traits/detail/yes_no_type.hpp>, changed
> the
> > > include guard, moved it from boost::type_traits to boost
> namespace (is
> that
> > > ok?
> >
> > You probably want to fix the copyright.
> >
> > > // (C) Copyright John Maddock and Steve Cleary 2000.
>
> Nah, that was intentional. After all, this existed from
> before, and it's
> very simple, :) so I need no credit for anything. Perhaps for
> the docs,
> though (to come).
>
> By the way, I see there are several suggested ways of
> defining these types,
> such as char and struct { char[2] } used in "C++ Templates",
> as Dave B. Held
> mentioned. It's the same for me what is used, as long as it
> works. :) Either
> form will likely be the same for the compiler, as well. I
> think the form
> used is quite nice and symmetric, though, but it may be
> changed, should
> anyone want to:
>
> typedef char (&yes_type)[1];
> typedef char (&no_type)[2];

Within the Boost.Spirit library we have the need to have not only two
distinct (size-)types, but something around a dozen. Wouldn't it be
better to provide something more general as the two (size-)type yes/no
solution? With Boost.PP this shouldn't be any problem.

Regards Hartmut


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