Class compressed_pair_imp< T1, T2, 2 >

Synopsis

#include <include/EASTL/bonus/compressed_pair.h>

template <typename T1, typename T2>
class compressed_pair_imp<T1, T2, 2> : private T2

Description

Derive from T2.

Inheritance

Ancestors: T2

Methods

compressed_pair_imp overload
first overload
second overload
swap

Source

Lines 204-242 in include/EASTL/bonus/compressed_pair.h.

template <typename T1, typename T2>
class compressed_pair_imp<T1, T2, 2> : private T2
{
public:
    typedef T1                                                 first_type;
    typedef T2                                                 second_type;
    typedef typename call_traits<first_type>::param_type       first_param_type;
    typedef typename call_traits<second_type>::param_type      second_param_type;
    typedef typename call_traits<first_type>::reference        first_reference;
    typedef typename call_traits<second_type>::reference       second_reference;
    typedef typename call_traits<first_type>::const_reference  first_const_reference;
    typedef typename call_traits<second_type>::const_reference second_const_reference;
    compressed_pair_imp() {}
    compressed_pair_imp(first_param_type x, second_param_type y)
        : second_type(y), mFirst(x) {}
    compressed_pair_imp(first_param_type x)
        : mFirst(x) {}
    compressed_pair_imp(second_param_type y)
        : second_type(y) {}
    first_reference       first()       { return mFirst; }
    first_const_reference first() const { return mFirst; }
    second_reference       second()       { return *this; }
    second_const_reference second() const { return *this; }
    void swap(compressed_pair<T1,T2>& y)
    {
        // No need to swap empty base class
        cp_swap(mFirst, y.first());
    }
private:
    first_type mFirst;
};





Add Discussion as Guest

Log in