forked from OctaForge/libostd
forwarding ctors
parent
e4738e0368
commit
5c0f051eac
|
@ -201,8 +201,9 @@ namespace detail {
|
||||||
T p_first;
|
T p_first;
|
||||||
U p_second;
|
U p_second;
|
||||||
|
|
||||||
CompressedPairBase(T a, U b): p_first(octa::forward<T>(a)),
|
template<typename TT, typename UU>
|
||||||
p_second(octa::forward<U>(b)) {}
|
CompressedPairBase(TT &&a, UU &&b): p_first(octa::forward<TT>(a)),
|
||||||
|
p_second(octa::forward<UU>(b)) {}
|
||||||
|
|
||||||
T &first() { return p_first; }
|
T &first() { return p_first; }
|
||||||
const T &first() const { return p_first; }
|
const T &first() const { return p_first; }
|
||||||
|
@ -220,8 +221,9 @@ namespace detail {
|
||||||
struct CompressedPairBase<T, U, 1>: T {
|
struct CompressedPairBase<T, U, 1>: T {
|
||||||
U p_second;
|
U p_second;
|
||||||
|
|
||||||
CompressedPairBase(T a, U b): T(octa::forward<T>(a)),
|
template<typename TT, typename UU>
|
||||||
p_second(octa::forward<U>(b)) {}
|
CompressedPairBase(TT &&a, UU &&b): T(octa::forward<TT>(a)),
|
||||||
|
p_second(octa::forward<UU>(b)) {}
|
||||||
|
|
||||||
T &first() { return *this; }
|
T &first() { return *this; }
|
||||||
const T &first() const { return *this; }
|
const T &first() const { return *this; }
|
||||||
|
@ -238,8 +240,9 @@ namespace detail {
|
||||||
struct CompressedPairBase<T, U, 2>: U {
|
struct CompressedPairBase<T, U, 2>: U {
|
||||||
T p_first;
|
T p_first;
|
||||||
|
|
||||||
CompressedPairBase(T a, U b): U(octa::forward<U>(b)),
|
template<typename TT, typename UU>
|
||||||
p_first(octa::forward<T>(a)) {}
|
CompressedPairBase(TT &&a, UU &&b): U(octa::forward<UU>(b)),
|
||||||
|
p_first(octa::forward<TT>(a)) {}
|
||||||
|
|
||||||
T &first() { return p_first; }
|
T &first() { return p_first; }
|
||||||
const T &first() const { return p_first; }
|
const T &first() const { return p_first; }
|
||||||
|
@ -254,8 +257,9 @@ namespace detail {
|
||||||
|
|
||||||
template<typename T, typename U>
|
template<typename T, typename U>
|
||||||
struct CompressedPairBase<T, U, 3>: T, U {
|
struct CompressedPairBase<T, U, 3>: T, U {
|
||||||
CompressedPairBase(T a, U b): T(octa::forward<T>(a)),
|
template<typename TT, typename UU>
|
||||||
U(octa::forward<U>(b)) {}
|
CompressedPairBase(TT &&a, UU &&b): T(octa::forward<TT>(a)),
|
||||||
|
U(octa::forward<UU>(b)) {}
|
||||||
|
|
||||||
T &first() { return *this; }
|
T &first() { return *this; }
|
||||||
const T &first() const { return *this; }
|
const T &first() const { return *this; }
|
||||||
|
@ -270,8 +274,9 @@ namespace detail {
|
||||||
struct CompressedPair: CompressedPairBase<T, U> {
|
struct CompressedPair: CompressedPairBase<T, U> {
|
||||||
typedef CompressedPairBase<T, U> Base;
|
typedef CompressedPairBase<T, U> Base;
|
||||||
|
|
||||||
CompressedPair(T a, U b): Base(octa::forward<T>(a),
|
template<typename TT, typename UU>
|
||||||
octa::forward<U>(b)) {}
|
CompressedPair(TT &&a, UU &&b): Base(octa::forward<TT>(a),
|
||||||
|
octa::forward<UU>(b)) {}
|
||||||
|
|
||||||
T &first() { return Base::first(); }
|
T &first() { return Base::first(); }
|
||||||
const T &first() const { return Base::first(); }
|
const T &first() const { return Base::first(); }
|
||||||
|
|
Loading…
Reference in New Issue