C++ Logo

std-discussion

Advanced search

Standard guarantees on moved-from container

From: Yongwei Wu <wuyongwei_at_[hidden]>
Date: Mon, 1 Jul 2024 23:32:48 +0800
On this page <URL:https://en.cppreference.com/w/cpp/container/vector/vector>,
I saw the wording "Move constructor. Constructs the container with the
contents of other using move semantics.... After the move, other is
guaranteed to be empty()."

Does the standard really provide this empty() guarantee (for vector,
or any other containers)? I cannot find it. I only see the general
specification that a moved-from object is in a valid but unspecified
state.

(If it does not provide this guarantee, should it?)

-- 
Yongwei Wu
URL: http://wyw.dcweb.cn/

Received on 2024-07-01 15:33:06