Boost logo

Boost :

From: Beman Dawes (beman_at_[hidden])
Date: 1999-07-08 07:50:40

At 10:10 PM 7/7/99 -0400, Dave Abrahams wrote:

>> * Someone [Nico?] writes a specification, including a sample
>> implementation, which is posted on The sample
>> implementation might be code that has to be inserted in actual
>> Standard Library container implementations. Messy, but the only
>> to get started, I think.
>I've seen this asserted several times, but honestly can't see why
>should be so. The whole point of the traits idiom (at least one
point) is
>that it's non-intrusive. See, for example, iterator_traits<char*>
>modified the definition of char*!) Can somebody justify the claim
that the
>containers would have to be modified?

Good point!

Traits appear in the standard library in (at least) two forms:

    * Embedded traits which become part of the container interface.
       Example: basic_char<> supplies a "traits_type" typedef.
       There is no way to add embedded traits to a container
       without modifying the container.
    * Non-embedded traits which do not become part of the
       container's interface. Example: iterator_traits<>,
       which describe iterators but are not part of the
       actual iterator interface; there is no "traits_type"
       typedef for iterators.

As long as the non-embedded form is used, traits are non-intrusive
and do not require modifications to the components they supply
information about.


------------------------------------------------------------------------ home: - Simplifying group communications

Boost list run by bdawes at, gregod at, cpdaniel at, john at