struct __add_ref<_Tp&>
{ typedef _Tp& type; };
- template<int _Idx, typename _Head, bool _IsEmpty>
+ template<std::size_t _Idx, typename _Head, bool _IsEmpty>
struct _Head_base;
- template<int _Idx, typename _Head>
+ template<std::size_t _Idx, typename _Head>
struct _Head_base<_Idx, _Head, true>
: public _Head
{
const _Head& _M_head() const { return *this; }
};
- template<int _Idx, typename _Head>
+ template<std::size_t _Idx, typename _Head>
struct _Head_base<_Idx, _Head, false>
{
_Head_base()
* point in the hierarchy; we use it to implement a constant-time
* get() operation.
*/
- template<int _Idx, typename... _Elements>
+ template<std::size_t _Idx, typename... _Elements>
struct _Tuple_impl;
/**
* Zero-element tuple implementation. This is the basis case for the
* inheritance recursion.
*/
- template<int _Idx>
+ template<std::size_t _Idx>
struct _Tuple_impl<_Idx> { };
/**
* and derive from a @c Tuple_impl containing the remaining elements
* (which contains the @c Tail).
*/
- template<int _Idx, typename _Head, typename... _Tail>
+ template<std::size_t _Idx, typename _Head, typename... _Tail>
struct _Tuple_impl<_Idx, _Head, _Tail...>
: public _Tuple_impl<_Idx + 1, _Tail...>,
private _Head_base<_Idx, _Head, std::is_empty<_Head>::value>
/// Gives the type of the ith element of a given tuple type.
- template<int __i, typename _Tp>
+ template<std::size_t __i, typename _Tp>
struct tuple_element;
/**
* Recursive case for tuple_element: strip off the first element in
* the tuple and retrieve the (i-1)th element of the remaining tuple.
*/
- template<int __i, typename _Head, typename... _Tail>
+ template<std::size_t __i, typename _Head, typename... _Tail>
struct tuple_element<__i, tuple<_Head, _Tail...> >
: tuple_element<__i - 1, tuple<_Tail...> > { };
template<typename... _Elements>
struct tuple_size<tuple<_Elements...> >
{
- static const int value = sizeof...(_Elements);
+ static const std::size_t value = sizeof...(_Elements);
};
template<typename... _Elements>
- const int tuple_size<tuple<_Elements...> >::value;
+ const std::size_t tuple_size<tuple<_Elements...> >::value;
- template<int __i, typename _Head, typename... _Tail>
+ template<std::size_t __i, typename _Head, typename... _Tail>
inline typename __add_ref<_Head>::type
__get_helper(_Tuple_impl<__i, _Head, _Tail...>& __t)
{ return __t._M_head(); }
- template<int __i, typename _Head, typename... _Tail>
+ template<std::size_t __i, typename _Head, typename... _Tail>
inline typename __add_c_ref<_Head>::type
__get_helper(const _Tuple_impl<__i, _Head, _Tail...>& __t)
{ return __t._M_head(); }
// Return a reference (const reference) to the ith element of a tuple.
// Any const or non-const ref elements are returned with their original type.
- template<int __i, typename... _Elements>
+ template<std::size_t __i, typename... _Elements>
inline typename __add_ref<
typename tuple_element<__i, tuple<_Elements...> >::type
>::type
get(tuple<_Elements...>& __t)
{ return __get_helper<__i>(__t); }
- template<int __i, typename... _Elements>
+ template<std::size_t __i, typename... _Elements>
inline typename __add_c_ref<
typename tuple_element<__i, tuple<_Elements...> >::type
>::type
{ return __get_helper<__i>(__t); }
// This class helps construct the various comparison operations on tuples
- template<int __check_equal_size, int __i, int __j,
+ template<std::size_t __check_equal_size, std::size_t __i, std::size_t __j,
typename _Tp, typename _Up>
struct __tuple_compare;
- template<int __i, int __j, typename _Tp, typename _Up>
+ template<std::size_t __i, std::size_t __j, typename _Tp, typename _Up>
struct __tuple_compare<0, __i, __j, _Tp, _Up>
{
static bool __eq(const _Tp& __t, const _Up& __u)
{
return (get<__i>(__t) == get<__i>(__u) &&
- __tuple_compare<0, __i+1, __j, _Tp, _Up>::__eq(__t, __u));
+ __tuple_compare<0, __i + 1, __j, _Tp, _Up>::__eq(__t, __u));
}
static bool __less(const _Tp& __t, const _Up& __u)
{
return ((get<__i>(__t) < get<__i>(__u))
|| !(get<__i>(__u) < get<__i>(__t)) &&
- __tuple_compare<0, __i+1, __j, _Tp, _Up>::__less(__t, __u));
+ __tuple_compare<0, __i + 1, __j, _Tp, _Up>::__less(__t, __u));
}
};
- template<int __i, typename _Tp, typename _Up>
+ template<std::size_t __i, typename _Tp, typename _Up>
struct __tuple_compare<0, __i, __i, _Tp, _Up>
{
static bool __eq(const _Tp&, const _Up&)
return __result_type(std::forward<_Elements>(__args)...);
}
- template<int...> struct __index_holder { };
+ template<std::size_t...> struct __index_holder { };
- template<int __i, typename _IdxHolder, typename... _Elements>
+ template<std::size_t __i, typename _IdxHolder, typename... _Elements>
struct __index_holder_impl;
- template<int __i, int... _Indexes, typename _IdxHolder, typename... _Elements>
+ template<std::size_t __i, std::size_t... _Indexes, typename _IdxHolder,
+ typename... _Elements>
struct __index_holder_impl<__i, __index_holder<_Indexes...>,
_IdxHolder, _Elements...>
{
_Elements...>::type type;
};
- template<int __i, int... _Indexes>
+ template<std::size_t __i, std::size_t... _Indexes>
struct __index_holder_impl<__i, __index_holder<_Indexes...> >
{ typedef __index_holder<_Indexes...> type; };
struct __make_index_holder
: __index_holder_impl<0, __index_holder<>, _Elements...> { };
- template<typename... _TElements, int... _TIdx,
- typename... _UElements, int... _UIdx>
+ template<typename... _TElements, std::size_t... _TIdx,
+ typename... _UElements, std::size_t... _UIdx>
inline tuple<_TElements..., _UElements...>
__tuple_cat_helper(const tuple<_TElements...>& __t,
const __index_holder<_TIdx...>&,
{ return tuple<_TElements..., _UElements...>(get<_TIdx>(__t)...,
get<_UIdx>(__u)...); }
- template<typename... _TElements, int... _TIdx,
- typename... _UElements, int... _UIdx>
+ template<typename... _TElements, std::size_t... _TIdx,
+ typename... _UElements, std::size_t... _UIdx>
inline tuple<_TElements..., _UElements...>
__tuple_cat_helper(tuple<_TElements...>&& __t,
const __index_holder<_TIdx...>&,
{ return tuple<_TElements..., _UElements...>
(std::move(get<_TIdx>(__t))..., get<_UIdx>(__u)...); }
- template<typename... _TElements, int... _TIdx,
- typename... _UElements, int... _UIdx>
+ template<typename... _TElements, std::size_t... _TIdx,
+ typename... _UElements, std::size_t... _UIdx>
inline tuple<_TElements..., _UElements...>
__tuple_cat_helper(const tuple<_TElements...>& __t,
const __index_holder<_TIdx...>&,
{ return tuple<_TElements..., _UElements...>
(get<_TIdx>(__t)..., std::move(get<_UIdx>(__u))...); }
- template<typename... _TElements, int... _TIdx,
- typename... _UElements, int... _UIdx>
+ template<typename... _TElements, std::size_t... _TIdx,
+ typename... _UElements, std::size_t... _UIdx>
inline tuple<_TElements..., _UElements...>
__tuple_cat_helper(tuple<_TElements...>&& __t,
const __index_holder<_TIdx...>&,
template<typename... _TElements, typename... _UElements>
inline tuple<_TElements..., _UElements...>
tuple_cat(const tuple<_TElements...>& __t, const tuple<_UElements...>& __u)
- {
+ {
return __tuple_cat_helper(__t, typename
__make_index_holder<_TElements...>::type(),
__u, typename
// class template array -*- C++ -*-
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
class tuple_size;
/// tuple_element
- template<int _Int, typename _Tp>
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<std::size_t _Int, typename _Tp>
+#else
+ template<int _Int, typename _Tp>
+#endif
class tuple_element;
template<typename _Tp, std::size_t _Nm>
struct tuple_size<array<_Tp, _Nm> >
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ { static const std::size_t value = _Nm; };
+#else
{ static const int value = _Nm; };
+#endif
template<typename _Tp, std::size_t _Nm>
- const int tuple_size<array<_Tp, _Nm> >::value;
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ const std::size_t
+#else
+ const int
+#endif
+ tuple_size<array<_Tp, _Nm> >::value;
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<std::size_t _Int, typename _Tp, std::size_t _Nm>
+#else
template<int _Int, typename _Tp, std::size_t _Nm>
+#endif
struct tuple_element<_Int, array<_Tp, _Nm> >
{ typedef _Tp type; };
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<std::size_t _Int, typename _Tp, std::size_t _Nm>
+#else
template<int _Int, typename _Tp, std::size_t _Nm>
+#endif
inline _Tp&
get(array<_Tp, _Nm>& __arr)
{ return __arr[_Int]; }
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<std::size_t _Int, typename _Tp, std::size_t _Nm>
+#else
template<int _Int, typename _Tp, std::size_t _Nm>
+#endif
inline const _Tp&
get(const array<_Tp, _Nm>& __arr)
{ return __arr[_Int]; }
-
// TR1 utility -*- C++ -*-
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
{
_GLIBCXX_BEGIN_NAMESPACE_TR1
- template<class _Tp> class tuple_size;
- template<int _Int, class _Tp> class tuple_element;
+ template<class _Tp>
+ class tuple_size;
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<std::size_t _Int, class _Tp>
+#else
+ template<int _Int, class _Tp>
+#endif
+ class tuple_element;
// Various functions which give std::pair a tuple-like interface.
template<class _Tp1, class _Tp2>
struct tuple_size<std::pair<_Tp1, _Tp2> >
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ { static const std::size_t value = 2; };
+#else
{ static const int value = 2; };
+#endif
template<class _Tp1, class _Tp2>
- const int tuple_size<std::pair<_Tp1, _Tp2> >::value;
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ const std::size_t
+#else
+ const int
+#endif
+ tuple_size<std::pair<_Tp1, _Tp2> >::value;
template<class _Tp1, class _Tp2>
struct tuple_element<0, std::pair<_Tp1, _Tp2> >
template<class _Tp1, class _Tp2>
struct tuple_element<1, std::pair<_Tp1, _Tp2> >
{ typedef _Tp2 type; };
-
- template<int _Int> struct __pair_get;
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<std::size_t _Int>
+#else
+ template<int _Int>
+#endif
+ struct __pair_get;
template<>
struct __pair_get<0>
{ return __pair.second; }
};
- template<int _Int, class _Tp1, class _Tp2>
- inline typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&
- get(std::pair<_Tp1, _Tp2>& __in)
- { return __pair_get<_Int>::__get(__in); }
-
- template<int _Int, class _Tp1, class _Tp2>
- inline const typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&
- get(const std::pair<_Tp1, _Tp2>& __in)
- { return __pair_get<_Int>::__const_get(__in); }
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<std::size_t _Int, class _Tp1, class _Tp2>
+#else
+ template<int _Int, class _Tp1, class _Tp2>
+#endif
+ inline typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&
+ get(std::pair<_Tp1, _Tp2>& __in)
+ { return __pair_get<_Int>::__get(__in); }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<std::size_t _Int, class _Tp1, class _Tp2>
+#else
+ template<int _Int, class _Tp1, class _Tp2>
+#endif
+ inline const typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&
+ get(const std::pair<_Tp1, _Tp2>& __in)
+ { return __pair_get<_Int>::__const_get(__in); }
_GLIBCXX_END_NAMESPACE_TR1
}