Let's look at some trivially move-constructible and (not trivially) copy-constructible (but still copy-constructible) user-defined (class) type A
:
struct A
{
A() = default;
A(A const &) {}
A(A &&) = default;
};
Then moving of A
(move-construction or move-assignment) literally perfroms the following: a source bitwise copied to a destination, despite of operation's name "moving". During trivial moving right hand side is (formally) not const
, but triviality of the whole operation requires (actual) non-mutability of right hand side, isn't it? On my mind it means, that trivial copy-operation and trivial move-operation are exactly the same in their deep nature (in terms of memory, memory-layout, bits etc). Am I right?
If it is so, then I think, if I see trivially move-constructible, but not trivially copy-constructible type in user code, then I evidently see some antipattern. Am I right?
Is there an example of such artificial but usable type, which is not trivially copy-constructible/assignable, but trivially move-constructible/assignable?