Boost logo

Boost :

From: wb_at_[hidden]
Date: 2001-11-26 18:26:04


Assuming the comment refers to the names type_is and value_is , the
intent, of course, is let_type_be<...> and let_value_be<...> , but
those are just too awkward to type, methinks. Or maybe not, on second
thought. Hmm.

In any event, it was not mainly for naming ideas that I sent the
implementation below. Sorry if the comments drew your eyes in that
direction.

For my purposes, I would like the value wrapper (whatever name boost
ultimately gives it) to handle all the integral types for which the
language permits non-type template arguments. I have use for unsigned
and signed ints of various sizes, as well as for bools, of course, and
would strongly prefer that a single value wrapper handle them all. The
alternative seems to be lots of value wrappers, one per type, and I'm
not fond of such proliferation.

In this context, I find it useful for the value wrapper to encompass
the type wrapper (by inheritance or by aggregation, it doesn't matter
to me) so that, if need be, I can inquire as to the wrapped value's
type. This, however, appears to conflict with other implementations.
Some seem not to address this at all, while others seem to prefer that
the wrapper's reported type (::type) be that of the wrapper itself.
Thus, there are a few issues beyond naming (as important as that is)
that ought be discussed, in my opinion, at least briefly.

        - WEB

David Abrahams <david.abrahams_at_[hidden]> wrote on Mon Nov 26 16:29:38 2001:

| Unfortunately, that sounds like a name for a compile-time predicate.
|
| ----- Original Message -----
| From: <wb_at_[hidden]>
|
| > Just as another source of ideas for these important constructs,
| > I attach a lightly-edited excerpt from SIunits' "metatypes" header
| > for consideration.
| >
| > - WEB
| >
| >
| > // ---------- begin excerpt ----------
| >
| > namespace meta {
| >
| > template< class T >
| > struct type_is // previous names: type_wrapper, my_type
| > {
| > typedef T type;
| > }
| >
| > template< class T, T v >
| > struct value_is // previous names: value_wrapper, my_value
| > : public type_is<T>
| > {
| > static T const value = v;
| > }
| >
| > } // namespace meta
| >
| > // ---------- end excerpt ----------
<previous messages snipped>


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