Boost logo

Boost :

From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2007-04-16 16:32:39

Felipe Magno de Almeida wrote:
> You seem to have arguments for both sides, undefined and usable
> object.

I'm terrible explaining my points. My main argument is that for objects
that have default-constructor (like shared_ptr), little overhead is
needed to implement full reusability. The same happens with containers
(except for maybe allocator copying, but stateful allocators are,
well..., not very well supported).

> I believe for most we want that move-constructors imply in
> almost-zero overhead, after all which is the benefit of moving a
> temporary if it has significant overhead?

The problem is that you might move objects that are not temporaries. See
my other post about std::vector

> You have written a lot of allocators for the shmem library, and you
> probably had to workaround the many copies that the standard allows.
> Wouldnt it be better to have:
> std::list<std::vector<...> > foo();
> Have almost 0 overhead instead of guaranteed usability of moved objects?

I think both can be achieved.

> IMHO, have assignment and destruction guaranteed to work on a moved
> object is guarantee enough.

Ok. I will add move constructor and move assignment. But that means they
are reusable. And that's my point.

> You seem to be proposing creating a new
> move-constructor, which I believe is now too late and a little bit
> more complex than needed. A simple moving + assignment is enough to
> have the object usable again.

I might have missed the assignment requirement in the discussion, sorry.
I thought that no guarantee was offered for a moved object.



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