std::CopyConstructible
Defined in header <concepts> | ||
---|---|---|
template <class T> concept CopyConstructible = std::MoveConstructible<T> && std::Constructible<T, T&> && std::ConvertibleTo<T&, T> && std::Constructible<T, const T&> && std::ConvertibleTo<const T&, T> && std::Constructible<T, const T> && std::ConvertibleTo<const T, T>; | (since C++20) |
The concept CopyConstructible
is satisfied if T
is an lvalue reference type, or if it is a MoveConstructible
object type where an object of that type can constructed from a (possibly const) lvalue or const rvalue of that type in both direct- and copy-initialization contexts with the usual semantics (a copy is constructed with the source unchanged).
More precisely, if T
is an object type, then CopyConstructible<T>
is satisfied only if given.
-
v
, a lvalue of type (possiblyconst
)T
or an rvalue of typeconst T
,
the following are true:
- After the definition
T u = v;
,u
is equal tov
; -
T(v)
is equal tov
.
See also
(C++11)(C++11)(C++11) | checks if a type has a copy constructor (class template) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/concepts/CopyConstructible