Why does libstdc ++ store std :: tuple elements in reverse order?

According to http://flamingdangerzone.com/cxx11/2012/07/06/optimal-tuple-i.html regarding std :: tuple ...

libstdC ++ always puts items in the reverse order, and libC ++ always puts members in the specified order

Assuming true, is there a reason (historical or otherwise) why libstdC ++ uses the reverse order?

Bonus: for any reason, has any implementation ever changed the order of std :: tuple?

+7
c ++ c ++ 11 libc ++ libstdc ++
Dec 27 '14 at 1:36 on
source share
1 answer

See this answer for why libC ++ chose forward order. As to why libstdC ++ chose the reverse order, this is probably due to the way it was demonstrated in the Variadics template proposal, and is a more obvious implementation.

Bonus: None. These orderings were stable in both libraries.

Update

libC ++ chose the storage order because:

  • It is possible.
  • The implementation has good compile time performance.
  • It provides libC ++ clients with something intuitive and controlled if they care about the storage order and are ready to depend on it when using libC ++, even though it is not defined.

In short, the libC ++ tuple developer simply felt that storing objects in the order that the client (implicitly) indicated the quality to be done.

+11
Dec 27 '14 at 1:39
source share



All Articles