Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2005-05-17 07:58:59


"David Abrahams" <dave_at_[hidden]> wrote in message
news:ur7g69ifb.fsf_at_boost-consulting.com...
| "Thorsten Ottosen" <nesotto_at_[hidden]> writes:
|
| > "Eric Niebler" <eric_at_[hidden]> wrote in message
| > news:428926DB.2090108_at_boost-consulting.com...
| > |
| > |
| > | Yes. It's exactly the same situation. You are giving collection<X>
| > | different semantics than collection<Y>.
| >
| > I guess my objection is to the use "exactly".
| >
| > If I have
| >
| > template< class T >
| > class my_vec
| > {
| > std::vector<T> vec;
| > };
| >
| > then I might need some traits for dealing with the bool case.
|
| What kind of traits?

the kind of traits that you usually use when dealing with vector<bool>. :-)

maybe you would replace vector<bool> with vector<int> under the hood.

| > If I have
| >
| > template< class Range, class OutIter >
| > void copy( const Range&, OutIter );
| >
| > then I just need to be able to say what a Range means.
|
| Yes, that's what makes your case worse. It doesn't just change the
| interface details as with vector<T>, it changes the fundamental
| meaning of T[N], leading to potential undefined behavior in some very
| common cases.

are you saying that the couldn't happen if we change the defaults?

Personally I don't care much about how most arrays are treated... but I do
think
having to write

find( rng, as_string("foo") );

is simply wierd and would be much more common than fiddling with fixed-sized
arrays with various sentinels.

-Thorsten


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