The fact that the solution is not to simply invoke the copy constructor, but to (portably!) write an ungodly mess that uses double-references, full noexcept(noexcept(repeat_of_body)) daisy-chaining, std::forward
(a function that doesn't forward), and probably constexpr, and probably explicit(explicit(...)) daisy-chaining, and probably requires(requires(...)) daisy-chaining, and probably constinit, and probably structured bindings, and probably yet another form of auto
, and so on..., demonstrates the problem with C++.
There's a place for macros, and this example shows it is precisely it. I'd just write MAKE_COPY(x)
.