Is there a rule that states in which order the members of std :: tuple are destroyed?
For example, if Function1 returns std::tuple<std::unique_ptr<ClassA>, std::unique_ptr<ClassB>> in Function2 , can I be sure that (when Function2 left), the ClassB instance referenced the second member is destroyed before the ClassA instance referenced by the first member?
std::tuple< std::unique_ptr< ClassA >, std::unique_ptr< ClassB > > Function1() { std::tuple< std::unique_ptr< ClassA >, std::unique_ptr< ClassB > > garbage; get<0>(garbage).reset( ); get<1>(garbage).reset( ); return garbage; } void Function2() { auto to_be_destroyed = Function1();
c ++ c ++ 11 std stdtuple
z32a7ul Aug 21 '16 at 20:25 2016-08-21 20:25
source share