6 typedef const TYPE type;
13 typedef volatile TYPE type;
19 typedef const volatile TYPE type;
32 typedef typename add_reference<TYPE>::typetype;
66template <
typename TYPE >
67void __swap(
const TYPE & t1,
const TYPE & t2)
79template<
class... TYPES>
92 tuple(
const tuple&)
noexcept
96 void __swap(TUPLE_TYPE&)
noexcept
100 bool equals(
const TUPLE_TYPE&)
noexcept
105 bool less(
const TUPLE_TYPE&)
noexcept
112 template<
class... TYPES2>
113 inline bool operator==(
const tuple<TYPES2...>& right)
115 return equals(right);
118 template<
class... TYPES2>
119 inline bool operator!=(
const tuple<TYPES2...>& right)
121 return !(*
this == right);
124 template<
class... TYPES2>
125 inline bool operator<(
const tuple<TYPES2...>& right)
130 template<
class... TYPES2>
131 inline bool operator>=(
const tuple<TYPES2...>& right)
133 return !(less(right));
136 template<
class... TYPES2>
137 inline bool operator>(
const tuple<TYPES2...>& right)
139 return right.less(*
this);
142 template<
class... TYPES2>
143 inline bool operator<=(
const tuple<TYPES2...>& right)
145 return !(right.less(*
this));
152template <
class TYPE,
class... REST>
153class tuple<TYPE,REST...>
154 :
public tuple<REST...>
157 typedef TYPE THIS_TYPE;
158 typedef tuple<TYPE,REST...> TUPLE_TYPE;
159 typedef tuple<REST...> BASE_TYPE;
160 static const size_t TYPE_SIZE = 1 +
sizeof...(REST);
169 template <
class... OTHER >
170 tuple(
const tuple<OTHER...>& right)
171 : BASE_TYPE(right.get_rest()),m_val(right.m_val)
175 template <
class... OTHER >
176 tuple(tuple<OTHER...>&& right)
177 : BASE_TYPE(::transfer(right.get_rest())),m_val(::transfer(right.m_val))
181 explicit tuple(
const TYPE& val,
const REST&... rest)
182 : BASE_TYPE(rest...),
187 explicit tuple(TYPE && val,
const REST &&... rest)
188 : BASE_TYPE(::transfer(rest...),m_val(::transfer(val))
193 template<
class... OTHER>
194 TUPLE_TYPE& operator=(
const tuple<OTHER...>& right)
197 (BASE_TYPE&)*
this = right.get_rest();
201 template<
class... OTHER>
202 TUPLE_TYPE& operator=(tuple<OTHER...>&& right)
204 m_val = ::transfer(right.m_val);
205 BASE_TYPE::operator = (::transfer(right.get_rest()));
209 template<
class... OTHER>
210 bool equals(
const tuple<OTHER...>& right)
const
212 return m_val == right.m_val && BASE_TYPE::equals(right.get_rest());
215 template<
class... OTHER>
216 bool less(
const tuple<OTHER...>& right)
const
218 return m_val < right.m_val || (!(right.m_val < m_val) && BASE_TYPE::less(right.get_rest()));
221 template <
class TYPE1,
class TYPE2>
222 tuple(
const pair < TYPE1, TYPE2 > & right) :
223 BASE_TYPE( tuple < TYPE2 > ( right.element2() ) ),
224 m_val(right.element1())
230 TUPLE_TYPE & operator=(
const TUPLE_TYPE & right)
235 BASE_TYPE::operator =(right.get_rest());
242 template <
class TYPE1,
class TYPE2>
243 TUPLE_TYPE & operator=(
const pair < TYPE1, TYPE2 >& right)
248 BASE_TYPE::operator =(tuple<TYPE2>(right.element2()));
255 template <
class TYPE1,
class TYPE2 >
256 tuple(pair < TYPE1, TYPE2 > && right) :
257 BASE_TYPE(tuple<TYPE2>(::transfer(right.second))),
258 m_val(::transfer(right.first))
264 TUPLE_TYPE & operator=(TUPLE_TYPE&& right)
267 m_val = ::transfer(right.m_val);
269 BASE_TYPE::operator = (::transfer(right.get_rest()));
276 template <
class TYPE1,
class TYPE2>
280 m_val = ::transfer(right.element1());
282 BASE_TYPE::operator = (tuple<TYPE2>(::transfer(right.second)));
289 BASE_TYPE & get_rest()
296 const BASE_TYPE & get_rest()
const
304 void __swap(tuple& right)
307 __swap(m_val,right.m_val);
309 BASE_TYPE::__swap((BASE_TYPE&)right);
315template<
class... TYPES>
318 return left.__swap(right);
322template<
size_t m_iIndex,
class TUPLE>
325template<
class TYPE1,
class... REST1>
332 typedef tuple<TYPE1,REST1...> TUPLE_TYPE;
335template<
size_t m_iIndex,
class TYPE1,
class... REST1>
342template<
size_t m_iIndex,
class TUPLE>
350template<
size_t m_iIndex,
class TUPLE>
358template<
size_t m_iIndex,
368template<
size_t m_iIndex,
class... TYPES>
372 return (((TUPLE_TYPE&)TUPLE).m_val);
375template<
size_t m_iIndex,
class... TYPES>
379 return (((TUPLE_TYPE&)TUPLE).m_val);
383template<
size_t m_iIndex,
class... TYPES>
389 return (::transfer(((TUPLE_TYPE&)TUPLE).m_val));
394template<
class... TYPES>
inline
395tuple < TYPES&&... > make_tuple(TYPES&&... args)
398 return ::transfer(args);
403template<
class... TYPES>
inline
405tie(TYPES&... args)
noexcept
408 typedef tuple<TYPES&...> TUPLE_TYPE;
410 return (TUPLE_TYPE(args...));
416template <
typename TYPE1,
typename TYPE2 >
417inline ::i32 cmp(
const TYPE1 & t1,
const TYPE2 & t2)
419 return (t1 < t2) ? -1 : (t1 < t2) ? 1 : 0;
423template <
typename TYPE1,
typename TYPE2 >
424inline ::i32 icmp(
const TYPE1 & t1,
const TYPE2 & t2)
430inline ::i32 cmp(const ::scoped_string & scopedstr1, const ::scoped_string & scopedstr2)
432 return str1.Compare(str2);
437inline ::i32 icmp(const ::scoped_string & scopedstr1,const ::scoped_string & scopedstr2)
439 return str1.CompareNoCase(str2);
442template<
size_t TUPLE_SIZE>
struct cmp_tuple
444 template <
typename T1,
typename T2>
445 ::i32 operator()(
const T1 & t1,
const T2 & t2)
const
447 ::i32 r = cmp_tuple<TUPLE_SIZE - 1>()(y1,t2);
448 return (r != 0) ? r : cmp(get<TUPLE_SIZE - 1>(t1),get<TUPLE_SIZE - 1>(t2));
455 template <
typename T1,
typename T2>
456 ::i32 operator()(
const T1 & t1,
const T2 & t2)
const
458 ::i32 r = icmp_tuple<TUPLE_SIZE - 1>()(y1,t2);
459 return (r != 0) ? r : icmp(get<TUPLE_SIZE - 1>(t1),get<TUPLE_SIZE - 1>(t2));
465 template <
typename T1,
typename T2>
466 ::i32 operator()(
const T1&,
const T2&)
const
474 template <
typename T1,
typename T2>
475 ::i32 operator()(
const T1&,
const T2&)
const
485template <
typename TYPE1,
typename TYPE2 >
486inline ::i32 cmp(const ::i32 & i1,const ::i32 & i2)
492template <
typename TYPE1,
typename TYPE2 >
493inline ::i32 cmp(const ::i16 & sh1,const ::i16 & sh2)
499template <
typename TYPE1,
typename TYPE2 >
500inline ::i32 cmp(const ::i8 & ch1,const ::i8 & ch2)
505template <
typename TYPE1,
typename TYPE2 >
506inline ::i32 cmp(const ::u32 & i1,const ::u32 & i2)
511template <
typename TYPE1,
typename TYPE2 >
512inline ::i32 cmp(const ::u16 & sh1,const ::i16 & sh2)
518template <
typename TYPE1,
typename TYPE2 >
519inline ::i32 cmp(const ::u8 & ch1,const ::u8 & ch2)
525template <
typename TYPE1,
typename TYPE2 >
526inline ::i32 cmp(const ::f64 & d1,const ::f64 & d2)
532template <
typename TYPE1,
typename TYPE2 >
533inline ::i32 cmp(const ::f32 & f1,const ::f32 & f2)
Definition _template_forward_declaration.h:327