Movables in std::vector

Magnus Fromreide magfr@lysator.liu.se
Wed Oct 12 20:48:00 GMT 2011


Hello.

Using trunk and c++0x-mode I tried to use a vector of a movable, but not
copyable, type.

That failed.

Looking inside stl_vector.h I find the following code line:

       __glibcxx_class_requires(_Tp, _SGIAssignableConcept)

and that seems to indicate that movable types aren't yet allowed in 
vectors. Is that intentional?

On the other hand http://gcc.gnu.org/onlinedocs/libstdc
++/manual/status.html#status.iso.200x seems to indicate that the c++11
support is finished in vector so that is a little confusing.

Ifdefing out the check for _SGIAssignableConcept seems to make vector
work with moveables but I have not done any big testing effort on that.

/MF



More information about the Libstdc++ mailing list