Copy and move assignment with vector -



Copy and move assignment with vector -

in process of answering question stumbled upon different wordings std::vector::erase() , std::deque::erase().

this c++14 draft n4140 says std::deque::erase ([deque.modifiers]/4-6, emphasis mine):

effects: ...

complexity: number of calls destructor same number of elements erased, number of calls assignment operator no more lesser of number of elements before erased elements , number of elements after erased elements.

throws: nil unless exception thrown re-create constructor, move constructor, assignment operator, or move assignment operator of t.

and here says std::vector::erase ([vector.modifiers]/3-5):

effects: ...

complexity: destructor of t called number of times equal number of elements erased, move assignment operator of t called number of times equal number of elements in vector after erased elements.

throws: nil unless exception thrown re-create constructor, move constructor, assignment operator, or move assignment operator of t.

as can see, exception specifications both of them same, std::vector it's explicitly mentioned move assignment operator called.

there's requirement t moveassignable erase() work both std::vector , std::deque (table 100), doesn't imply presence of move assignment operator: 1 can define re-create assignment operator, , not define move assignment operator, , class moveassignable.

just in case, checked gcc , clang, , indeed std::vector::erase() calls re-create assignment operator if there's no move assignment operator, , std::deque::erase() same (demo).

so question is: did miss something, or (editorial) issue in standard?

copy

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -