Commit 049d2893 by Paolo Carlini Committed by Paolo Carlini

tuple: Use everywhere std::size_t...

2011-09-09  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/std/tuple: Use everywhere std::size_t... instead of int...
	* include/std/functional: Likewise.
	* include/std/scoped_allocator: Likewise.
	* include/bits/stl_pair.h: Likewise.

From-SVN: r178746
parent 25e723bd
2011-09-09 Paolo Carlini <paolo.carlini@oracle.com> 2011-09-09 Paolo Carlini <paolo.carlini@oracle.com>
* include/std/tuple: Use everywhere std::size_t... instead of int...
* include/std/functional: Likewise.
* include/std/scoped_allocator: Likewise.
* include/bits/stl_pair.h: Likewise.
2011-09-09 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/50336 PR libstdc++/50336
* include/bits/streambuf_iterator.h (class istreambuf_iterator): * include/bits/streambuf_iterator.h (class istreambuf_iterator):
Implement LWG 445 in C++0x mode. Implement LWG 445 in C++0x mode.
......
...@@ -79,7 +79,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -79,7 +79,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename...> template<typename...>
class tuple; class tuple;
template<int...> template<std::size_t...>
struct _Index_tuple; struct _Index_tuple;
#endif #endif
...@@ -206,7 +206,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -206,7 +206,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static _Tp static _Tp
__cons(tuple<_Args...>&&); __cons(tuple<_Args...>&&);
template<typename _Tp, typename... _Args, int... _Indexes> template<typename _Tp, typename... _Args, std::size_t... _Indexes>
static _Tp static _Tp
__do_cons(tuple<_Args...>&&, const _Index_tuple<_Indexes...>&); __do_cons(tuple<_Args...>&&, const _Index_tuple<_Indexes...>&);
#endif #endif
......
...@@ -914,7 +914,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) ...@@ -914,7 +914,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
* template handles the case where it is safe to use @c * template handles the case where it is safe to use @c
* tuple_element. * tuple_element.
*/ */
template<int __i, typename _Tuple, bool _IsSafe> template<std::size_t __i, typename _Tuple, bool _IsSafe>
struct _Safe_tuple_element_impl struct _Safe_tuple_element_impl
: tuple_element<__i, _Tuple> { }; : tuple_element<__i, _Tuple> { };
...@@ -923,7 +923,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) ...@@ -923,7 +923,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
* specialization handles the case where it is not safe to use @c * specialization handles the case where it is not safe to use @c
* tuple_element. We just return @c _No_tuple_element. * tuple_element. We just return @c _No_tuple_element.
*/ */
template<int __i, typename _Tuple> template<std::size_t __i, typename _Tuple>
struct _Safe_tuple_element_impl<__i, _Tuple, false> struct _Safe_tuple_element_impl<__i, _Tuple, false>
{ {
typedef _No_tuple_element type; typedef _No_tuple_element type;
...@@ -933,10 +933,10 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) ...@@ -933,10 +933,10 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
* Like tuple_element, but returns @c _No_tuple_element when * Like tuple_element, but returns @c _No_tuple_element when
* tuple_element would return an error. * tuple_element would return an error.
*/ */
template<int __i, typename _Tuple> template<std::size_t __i, typename _Tuple>
struct _Safe_tuple_element struct _Safe_tuple_element
: _Safe_tuple_element_impl<__i, _Tuple, : _Safe_tuple_element_impl<__i, _Tuple,
(__i >= 0 && __i < tuple_size<_Tuple>::value)> (__i < tuple_size<_Tuple>::value)>
{ }; { };
/** /**
...@@ -999,7 +999,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) ...@@ -999,7 +999,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
private: private:
// Invokes the underlying function object __arg by unpacking all // Invokes the underlying function object __arg by unpacking all
// of the arguments in the tuple. // of the arguments in the tuple.
template<typename _CVArg, typename... _Args, int... _Indexes> template<typename _CVArg, typename... _Args, std::size_t... _Indexes>
auto auto
__call(_CVArg& __arg, tuple<_Args...>& __tuple, __call(_CVArg& __arg, tuple<_Args...>& __tuple,
const _Index_tuple<_Indexes...>&) const volatile const _Index_tuple<_Indexes...>&) const volatile
...@@ -1112,14 +1112,14 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) ...@@ -1112,14 +1112,14 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
}; };
// std::get<I> for volatile-qualified tuples // std::get<I> for volatile-qualified tuples
template<size_t _Ind, typename... _Tp> template<std::size_t _Ind, typename... _Tp>
inline auto inline auto
__volget(volatile tuple<_Tp...>& __tuple) __volget(volatile tuple<_Tp...>& __tuple)
-> typename tuple_element<_Ind, tuple<_Tp...>>::type volatile& -> typename tuple_element<_Ind, tuple<_Tp...>>::type volatile&
{ return std::get<_Ind>(const_cast<tuple<_Tp...>&>(__tuple)); } { return std::get<_Ind>(const_cast<tuple<_Tp...>&>(__tuple)); }
// std::get<I> for const-volatile-qualified tuples // std::get<I> for const-volatile-qualified tuples
template<size_t _Ind, typename... _Tp> template<std::size_t _Ind, typename... _Tp>
inline auto inline auto
__volget(const volatile tuple<_Tp...>& __tuple) __volget(const volatile tuple<_Tp...>& __tuple)
-> typename tuple_element<_Ind, tuple<_Tp...>>::type const volatile& -> typename tuple_element<_Ind, tuple<_Tp...>>::type const volatile&
...@@ -1141,7 +1141,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) ...@@ -1141,7 +1141,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
tuple<_Bound_args...> _M_bound_args; tuple<_Bound_args...> _M_bound_args;
// Call unqualified // Call unqualified
template<typename _Result, typename... _Args, int... _Indexes> template<typename _Result, typename... _Args, std::size_t... _Indexes>
_Result _Result
__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>)
{ {
...@@ -1150,7 +1150,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) ...@@ -1150,7 +1150,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
} }
// Call as const // Call as const
template<typename _Result, typename... _Args, int... _Indexes> template<typename _Result, typename... _Args, std::size_t... _Indexes>
_Result _Result
__call_c(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) const __call_c(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) const
{ {
...@@ -1159,7 +1159,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) ...@@ -1159,7 +1159,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
} }
// Call as volatile // Call as volatile
template<typename _Result, typename... _Args, int... _Indexes> template<typename _Result, typename... _Args, std::size_t... _Indexes>
_Result _Result
__call_v(tuple<_Args...>&& __args, __call_v(tuple<_Args...>&& __args,
_Index_tuple<_Indexes...>) volatile _Index_tuple<_Indexes...>) volatile
...@@ -1169,7 +1169,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) ...@@ -1169,7 +1169,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
} }
// Call as const volatile // Call as const volatile
template<typename _Result, typename... _Args, int... _Indexes> template<typename _Result, typename... _Args, std::size_t... _Indexes>
_Result _Result
__call_c_v(tuple<_Args...>&& __args, __call_c_v(tuple<_Args...>&& __args,
_Index_tuple<_Indexes...>) const volatile _Index_tuple<_Indexes...>) const volatile
...@@ -1272,7 +1272,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) ...@@ -1272,7 +1272,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
struct __disable_if_void : enable_if<!is_void<_Res>::value, int> { }; struct __disable_if_void : enable_if<!is_void<_Res>::value, int> { };
// Call unqualified // Call unqualified
template<typename _Res, typename... _Args, int... _Indexes> template<typename _Res, typename... _Args, std::size_t... _Indexes>
_Result _Result
__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>,
typename __disable_if_void<_Res>::type = 0) typename __disable_if_void<_Res>::type = 0)
...@@ -1282,7 +1282,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) ...@@ -1282,7 +1282,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
} }
// Call unqualified, return void // Call unqualified, return void
template<typename _Res, typename... _Args, int... _Indexes> template<typename _Res, typename... _Args, std::size_t... _Indexes>
void void
__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>,
typename __enable_if_void<_Res>::type = 0) typename __enable_if_void<_Res>::type = 0)
...@@ -1292,7 +1292,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) ...@@ -1292,7 +1292,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
} }
// Call as const // Call as const
template<typename _Res, typename... _Args, int... _Indexes> template<typename _Res, typename... _Args, std::size_t... _Indexes>
_Result _Result
__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>,
typename __disable_if_void<_Res>::type = 0) const typename __disable_if_void<_Res>::type = 0) const
...@@ -1302,7 +1302,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) ...@@ -1302,7 +1302,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
} }
// Call as const, return void // Call as const, return void
template<typename _Res, typename... _Args, int... _Indexes> template<typename _Res, typename... _Args, std::size_t... _Indexes>
void void
__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>,
typename __enable_if_void<_Res>::type = 0) const typename __enable_if_void<_Res>::type = 0) const
...@@ -1312,7 +1312,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) ...@@ -1312,7 +1312,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
} }
// Call as volatile // Call as volatile
template<typename _Res, typename... _Args, int... _Indexes> template<typename _Res, typename... _Args, std::size_t... _Indexes>
_Result _Result
__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>,
typename __disable_if_void<_Res>::type = 0) volatile typename __disable_if_void<_Res>::type = 0) volatile
...@@ -1322,7 +1322,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) ...@@ -1322,7 +1322,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
} }
// Call as volatile, return void // Call as volatile, return void
template<typename _Res, typename... _Args, int... _Indexes> template<typename _Res, typename... _Args, std::size_t... _Indexes>
void void
__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>,
typename __enable_if_void<_Res>::type = 0) volatile typename __enable_if_void<_Res>::type = 0) volatile
...@@ -1332,7 +1332,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) ...@@ -1332,7 +1332,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
} }
// Call as const volatile // Call as const volatile
template<typename _Res, typename... _Args, int... _Indexes> template<typename _Res, typename... _Args, std::size_t... _Indexes>
_Result _Result
__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>, __call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>,
typename __disable_if_void<_Res>::type = 0) const volatile typename __disable_if_void<_Res>::type = 0) const volatile
...@@ -1342,7 +1342,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) ...@@ -1342,7 +1342,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
} }
// Call as const volatile, return void // Call as const volatile, return void
template<typename _Res, typename... _Args, int... _Indexes> template<typename _Res, typename... _Args, std::size_t... _Indexes>
void void
__call(tuple<_Args...>&& __args, __call(tuple<_Args...>&& __args,
_Index_tuple<_Indexes...>, _Index_tuple<_Indexes...>,
...@@ -1533,7 +1533,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) ...@@ -1533,7 +1533,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
private: private:
template<int... _Indices> template<std::size_t... _Indices>
typename result_of<_Callable(_Args...)>::type typename result_of<_Callable(_Args...)>::type
_M_invoke(_Index_tuple<_Indices...>) _M_invoke(_Index_tuple<_Indices...>)
{ {
......
...@@ -234,7 +234,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -234,7 +234,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __a_traits::select_on_container_copy_construction(__a); return __a_traits::select_on_container_copy_construction(__a);
} }
template<int... _Indices> template<std::size_t... _Indices>
scoped_allocator_adaptor(tuple<const _OuterAlloc&, scoped_allocator_adaptor(tuple<const _OuterAlloc&,
const _InnerAllocs&...> __refs, const _InnerAllocs&...> __refs,
_Index_tuple<_Indices...>) _Index_tuple<_Indices...>)
......
...@@ -1011,7 +1011,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1011,7 +1011,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* Stores a tuple of indices. Used by bind() to extract the elements * Stores a tuple of indices. Used by bind() to extract the elements
* in a tuple. * in a tuple.
*/ */
template<int... _Indexes> template<std::size_t... _Indexes>
struct _Index_tuple struct _Index_tuple
{ {
typedef _Index_tuple<_Indexes..., sizeof...(_Indexes)> __next; typedef _Index_tuple<_Indexes..., sizeof...(_Indexes)> __next;
...@@ -1042,7 +1042,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1042,7 +1042,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
template<class _T1, class _T2> template<class _T1, class _T2>
template<typename _Tp, typename... _Args, int... _Indexes> template<typename _Tp, typename... _Args, std::size_t... _Indexes>
inline _Tp inline _Tp
pair<_T1, _T2>::__do_cons(tuple<_Args...>&& __tuple, pair<_T1, _T2>::__do_cons(tuple<_Args...>&& __tuple,
const _Index_tuple<_Indexes...>&) const _Index_tuple<_Indexes...>&)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment