I want to know if I am doing this correctly. I have a class containing some data:
class Foo {
// ...
Type a_;
Type b_;
Type c_;
};
And another class that does something else, but is built using class Foo. So, I believe ctor looks like this:
class Bar {
Type a_;
Type b_;
Type c_;
AnotherType A_;
AnotherType B_;
public:
typedef std::tuple<Type, Type, Type> Tuple;
Bar(const Tuple&);
Bar(Tuple&&);
};
Now I need to create a method Foothat will return a tuple of data members for which I need Bar, which I can pass to Barctor. I also make an rvalue reference for Tuple, because these data elements are class Foono longer needed except through class Bar, so why bother copying the data when I can move it?
, class Foo, a Tuple. , , Bar ctor, rvalue. ?
auto Foo::move_data() -> Tuple&& {
return std::move( Tuple(a_, b_, c_) );
}
? ( - , . , typedefs .)