iffl  1.3.4
Implements Intrusive Flat Forward List container
Public Member Functions | List of all members
iffl::compressed_pair< T1, T2, bool > Class Template Referencefinal

Empty Base Class Optimization EBCO helper. More...

#include <iffl_common.h>

Inheritance diagram for iffl::compressed_pair< T1, T2, bool >:

Public Member Functions

template<class... P>
constexpr compressed_pair (zero_then_variadic_args_t, P &&... p)
 Constructor. More...
 
template<class P1 , class... P2>
constexpr compressed_pair (one_then_variadic_args_t, P1 &&p1, P2 &&... p2)
 Constructor. More...
 
constexpr T1 & get_first () noexcept
 Returns a reference to the first element of compressed pair.
 
constexpr T1 const & get_first () const noexcept
 Returns a const reference to the first element of compressed pair.
 
constexpr T2 & get_second () noexcept
 Returns a reference to the second element of compressed pair.
 
constexpr T2 const & get_second () const noexcept
 Returns a const reference to the second element of compressed pair.
 

Detailed Description

template<class T1, class T2, bool = std::is_empty_v<T1> && !std::is_final_v<T1>>
class iffl::compressed_pair< T1, T2, bool >

Empty Base Class Optimization EBCO helper.

Template Parameters
T1- First type is inherited from if it is possible, and if it safes space
T2- Second type is always a member

Store a pair of values, deriving from empty first. This is a general template for the case when inheriting from T1 would help. We use SFINAE on the 3rd parameter to fail this instantiation when EBCO would not help or would not work. Other specialization should be used in that case. This is a naive implementation borrowed from the MSVC CRT. More complete implementation can be found in boost

Constructor & Destructor Documentation

◆ compressed_pair() [1/2]

template<class T1, class T2, bool = std::is_empty_v<T1> && !std::is_final_v<T1>>
template<class... P>
constexpr iffl::compressed_pair< T1, T2, bool >::compressed_pair ( zero_then_variadic_args_t  ,
P &&...  p 
)
inlineexplicit

Constructor.

Template Parameters
P- triadic parameter pack forwarded to the constructor of T2
Parameters
p- parameters for the T2 constructor

Value initialize first parameter, and passes all other parameters to the constructor of second

◆ compressed_pair() [2/2]

template<class T1, class T2, bool = std::is_empty_v<T1> && !std::is_final_v<T1>>
template<class P1 , class... P2>
constexpr iffl::compressed_pair< T1, T2, bool >::compressed_pair ( one_then_variadic_args_t  ,
P1 &&  p1,
P2 &&...  p2 
)
inline

Constructor.

Template Parameters
P1- parameter used to initialize T1
P2- variadic parameter pack forwarded to the constructor of T2
Parameters
p1- parameter for the T1 constructor
p2- parameters for the T2 constructor

Constructs first parameter from p1, and passes all other parameters to the constructor of second.


The documentation for this class was generated from the following file: