Boost logo

Boost :

From: JOAQUIN LOPEZ MU?Z (joaquin_at_[hidden])
Date: 2005-05-27 17:05:16

----- Mensaje original -----
De: Peter Dimov <pdimov_at_[hidden]>
Fecha: Viernes, Mayo 27, 2005 11:10 pm
Asunto: Re: [boost] Re: compressed_pair requirements?

> > IMHO, std::pair default ctor should be defined as
> >
> > pair():first(),second(){}
> This doesn't change things. pair() {} is what you probably want.

Why? (This is not a rethoric question, my understanding
of value-initialization matters is so poor.)

> What can I say, I'm glad that your and Howard's view didn't
> prevail when
> std::pair was being defined. If I had it MY way,
> typedef set<int> int_set;
> pair<int_set::iterator,int_set­::iterator> p;
> would have compiled on no compiler because int_set::iterator
> wouldn't even
> have had a default constructor.

I think there's some value in having iterators being
DefaultConstructible. Otherwise you're forced to have
some container around everytime you construct an iterator.
Defaut construction for iterators is roughly
the equivalent of initializing to 0 in the case of pointers.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo

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