Boost logo

Boost :

From: Jan Gaspar (jano_gaspar_at_[hidden])
Date: 2004-03-05 08:37:10


Hello!

>
> > 1. your rationale mentions many characteristics
> that
> > I would expect of
> > std::deque. Do you have any idea
> > how big the performance difference is?
> The memory is allocated at once, that's the biggest
> difference.
> ------------
> What I'm looking for is some more evidence that the
> data structure is really
> faster. I think that
> is relevant since that is your reason d'etre (or
> something, I never took
> French in highschool :-) )
> for the container.
I agree with Pavel. Moreover you would have no control
over iterator invalidation in std::deque.

>
> >
> > 2. You mention "Guarantee of basic exception
> safety"
> > as a design criteria. I
> > would expect many operations
> > to have a stronger guarantee.
> Of cource, some methods provide stronger guarantee,
> but in general the container povides just basic
> exception safety. For some methods (e.g. insert) it
> is
> impossible to provide stronger guarantees.
> -------------
> I guess I would like to know the exact guarantee of
> each function. It will
> be important
> for eg. when I have to provide a pointer version of
> circular_buffer for my
> smart containers.
Ok, agree. Every method will have statement about its
exception safety guarantee in the documentation.

>
> > 4. Type Requirements: don't T need to be
> Assignable
> > too?
> Just no!
> ---------
> Then how is an element overwritten?
Look at the replace() method in the source code.

> >
> > 7. when you state contracts like
> > Precondition:
> > *(this).size() > index
> > don't you mean (*this).size() ? I would prefer
> that
> > you omitted this
> > entirely.
> This is just typo. Anyway I would retain the
> precondition.
> ----------
> yes, I'm not talking about removing the
> precondition. I just don't think
> 'this->' adds
> anything. size() > index would be fine to me.
Agree.

>
> >
> > 8. maybe you should add const_pointer data() const
> ?
> It is not possible. data() is mutating operation.
> See
> the source code.
> ---------------
> ok. then maybe one should get more hints about this
> mutation (I did not have
> a clue), maybe like
> c.prepare_array();
> foo( &*c.begin() );
There are some words regarding iterator invalidation
in the method documentation.

> And what complexity does it involves (linear, I
> assume)?
Yes, linear.

Jan

__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com


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