I am working on a class of matrix representations from which the constructor takes the matrix as a parameter and binds it to the const element of the link. I would really like to avoid the rvalues ββbinding, since they do not bind using the constructor parameter, and we end up with a link. I came up with the following (simplified code):
struct Foo{}; class X { const Foo& _foo; public: X(const Foo&&) = delete;
I basically delete the constructor that takes const Foo&& as a parameter. Note that I need const , because otherwise, someone might return const Foo from the function, in which case it will be bound to the const Foo& constructor.
Question:
Is this the correct paradigm for disabling rvalue bindings? Did I miss something?
c ++ c ++ 11 rvalue-reference
vsoftco Oct 20 '15 at 19:10 2015-10-20 19:10
source share