Class compressed_pair_imp< T1, T2, 1 >

Synopsis

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

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

Description

Derive from T1.

Inheritance

Ancestors: T1

Methods

compressed_pair_imp overload
first overload
second overload
swap

Source

Lines 161-199 in include/EASTL/bonus/compressed_pair.h.

template <typename T1, typename T2>
class compressed_pair_imp<T1, T2, 1> : private T1
{
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)
        : first_type(x), mSecond(y) {}
    compressed_pair_imp(first_param_type x)
        : first_type(x) {}
    compressed_pair_imp(second_param_type y)
        : mSecond(y) {}
    first_reference       first()       { return *this; }
    first_const_reference first() const { return *this; }
    second_reference       second()       { return mSecond; }
    second_const_reference second() const { return mSecond; }
    void swap(compressed_pair<T1,T2>& y)
    {
        // No need to swap empty base class
        cp_swap(mSecond, y.second());
    }
private:
    second_type mSecond;
};





Add Discussion as Guest

Log in