DP
Size: a a a
DP
d
d
C
AG
MyClass(MyClass&& other) noexcept : x_(move(other.x_)) {}MyClass(const MyClass& other) : x_(other.x_){}То как будет выглядеть универсальная версия (через универсальную ссылку), чтобы заменить эти 2 на 1? Я представляю это типа:
template <typename T>
MyClass(T&& mc);
LA
AG
DP
template <typename T>
MyClass(T&& mc);
T
AG
DP
LA
O
move
, а std::forward
DP
DP
struct S {
S() = default;
template<typename T, std::enable_if_t<std::is_same_v<S, T>>* = nullptr>
S(T&& t) {}
};
int main() {
const S s1;
S s2{s1};
S s3{s2};
}
DP
LA
DP
LA
С