I have a Foo class.
I need a TakeFoo function that takes a Foo object and calls methods on it. This is where I started:
void TakeFoo (const Foo&);
However, I also need to be able to call non-constant methods on it. Therefore, I change this to the following:
void TakeFoo (Foo&);
However, this triggers warnings when I try to give it a temporary. Therefore, I create an overload:
void TakeFoo (Foo&&);
However, I want to reuse the code, so TakeFoo(Foo&&) basically does this:
void TakeFoo (Foo&& FooBar) { TakeFoo(FooBar); }
Why doesn't this raise a warning because I'm still not referring to the temporary?
source share