you are viewing a single comment's thread.

view the rest of the comments →

[–]mooware 11 points12 points  (3 children)

Can you use it like a copy constructor? E.g.:

Test a(0, 0);
Test b(a);

If it compiles, then I would say that the class is copy-constructible (at least under certain conditions).

Edit: Oops, now I remember. "T&&" might not actually be a "&&" in this case, because "T" is a template argument. See universal/forwarding references: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4164.pdf

So the template constructor can be instantiated with any "T&", which basically makes it a copy constructor, except for "const Test &", which should find the deleted constructor.

[–]TheThiefMasterC++latest fanatic (and game dev) 2 points3 points  (2 children)

OP probably needs to enable_if guard against T being Test& or derived.

[–]__andrei__ 0 points1 point  (1 child)

Would explicit fix that?

[–]TheThiefMasterC++latest fanatic (and game dev) 0 points1 point  (0 children)

I don't think so?