Std :: tuple is required to use empty base class optimization?
1 answer
No, there is no requirement to tuple
use inheritance to enable empty base class optimization.
The only textual specification of the tuple library is:
This subclause describes a tuple library that provides a tuple type as a class template tuple that can be created with any number of arguments. Each template argument specifies the type of the element in the tuple. Hence, tuples are heterogeneous, fixed sets of values. Instantiating a tuple with two arguments is similar to instantiating a pair with the same two arguments.
without mentioning any implementation details; and the template specification begins:
template <class... Types>
class tuple {
without indicating that it should inherit from anything.
+6
source to share