Boost logo

Boost :

From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2001-08-27 10:22:54


----- Original Message -----
From: Vesa Karvonen <vesa.karvonen_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Monday, August 27, 2001 12:07 PM
Subject: [boost] "Strict" type traits

> Several type traits currently require special support from the user or the
> compiler. [I think that this is highly undesirable for several reasons.]
These
> traits include (with some special cases) at least:
>
> is_class
> is_enum
> is_union
> is_POD
> is_empty
> has_trivial_constructor
> has_trivial_copy
> has_trivial_assign
> has_trivial_destructor
>
> In the case that a particular trait is not specialized, the current type
> traits implementation typically return false, which can typically be
> considered safe.
>
> However, in some cases, the user may really want to know the real answer
and
> is willing to write the specializations whenever an unknown type is found.
> Perhaps the user makes use of traits for specializing algorithms or
> interfacing with other languages and likes to make sure that everything
works
> as intended.
>
> Possible solutions:
> - Core language support.
>
> - Strict traits that would fail or return "probably_false" whenever they
can
> not make a definite answer:
>
> is_class_strict
> is_enum_strict
> is_union_strict
> is_POD_strict
> is_empty_strict
> has_trivial_constructor_strict
> has_trivial_copy_strict
> has_trivial_assign_strict
> has_trivial_destructor_strict
>
> - Separately implemented negative traits, which can be cross checked with
the
> positive traits:
>
> is_not_class
> is_not_enum
> is_not_union
> is_not_POD
> is_not_empty
> has_no_trivial_constructor
> has_no_trivial_copy
> has_no_trivial_assign
> has_no_trivial_destructor
>
>
Off the top of my head I would vote for negative traits and double checking.
At least, that's what I've been doing and it worked well so far.

Fernando Cacciola
Sierra s.r.l.
fcacciola_at_[hidden]
www.gosierra.com


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