carb::EmptyMemberPair
Defined in carb/Defines.h
-
template<class First, class Second, bool = std::is_empty<First>::value && !std::is_final<First>::value>
class EmptyMemberPair : private First Attempts to invoke the Empty Member Optimization by inheriting from the First element if possible, which, if empty will eliminate the storage necessary for an empty class; the Second element is always stored as a separate member. The First element is inherited from if it is an empty
class
/struct
and is not declaredfinal
.- Template Parameters
First – The first element of the pair that the pair will inherit from if empty and not
final
.Second – The second element of the pair that will always be a member.
Public Types
Public Functions
-
template<class ...Args2>
inline explicit constexpr EmptyMemberPair(ValueInitFirst, Args2&&... args) Constructor that default-initializes the
First
member and passes all arguments to the constructor ofSecond
.- Parameters
args – arguments passed to the constructor of
second
.
-
template<class Arg1, class ...Args2>
inline explicit constexpr EmptyMemberPair(InitBoth, Arg1 &&arg1, Args2&&... args2) Constructor that initializes both members.
- Parameters
arg1 – the argument that is forwarded to the
First
constructor.args2 – arguments passed to the constructor of
second
.
Public Members
-
SecondType second
Direct access to the
Second
member.