You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by el...@apache.org on 2008/07/03 00:49:15 UTC
svn commit: r673534 - in /stdcxx/branches/4.3.x/include: rw/_forward.h
rw/_ref_wrap.h rw/_tuple.h tuple
Author: elemings
Date: Wed Jul 2 15:49:15 2008
New Revision: 673534
URL: http://svn.apache.org/viewvc?rev=673534&view=rev
Log:
2008-07-02 Eric Lemings <er...@roguewave.com>
STDCXX-958
* include/tuple: Use `_TypeT' and `_TypesT' template parameter
names. Add comment clarifying necessary static casts. Use
_RWSTD_SIZE_T type for index of tuple elements per LWG issue
#755.
* include/rw/_forward.h: More template parameter renaming.
* include/rw/_ref_wrap.h: Likewise.
* include/rw/_tuple.h: Likewise.
Incorporates more initial code review comments:
http://www.nabble.com/Re%3A-Tuple-status-p18230401.html
Modified:
stdcxx/branches/4.3.x/include/rw/_forward.h
stdcxx/branches/4.3.x/include/rw/_ref_wrap.h
stdcxx/branches/4.3.x/include/rw/_tuple.h
stdcxx/branches/4.3.x/include/tuple
Modified: stdcxx/branches/4.3.x/include/rw/_forward.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/rw/_forward.h?rev=673534&r1=673533&r2=673534&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_forward.h (original)
+++ stdcxx/branches/4.3.x/include/rw/_forward.h Wed Jul 2 15:49:15 2008
@@ -42,42 +42,42 @@
// 20.2.2, forward/move helpers:
-template <class _Type>
+template <class _TypeT>
struct identity
{
- typedef _Type type;
+ typedef _TypeT type;
- const _Type& operator() (const _Type& __x) const {
+ const type& operator() (const type& __x) const {
return __x;
}
};
-# define _RWSTD_IDENTITY(_Type) _STD::identity<_Type>::type
+# define _RWSTD_IDENTITY(_TypeT) _STD::identity<_TypeT>::type
# if !defined _RWSTD_NO_RVALUE_REFERENCES
-template <class _Type>
-inline _Type&&
-forward (_TYPENAME identity<_Type>::type&& __x)
+template <class _TypeT>
+inline _TypeT&&
+forward (_TYPENAME identity<_TypeT>::type&& __x)
{
return __x;
}
-template <class _Type>
-inline _TYPENAME _RWSTD_REMOVE_REFERENCE(_Type)&&
-move (_Type&& __x)
+template <class _TypeT>
+inline _TYPENAME _RWSTD_REMOVE_REFERENCE(_TypeT)&&
+move (_TypeT&& __x)
{
return __x;
}
-# define _RWSTD_FORWARD(_Type, __x) _STD::forward<_Type> (__x)
+# define _RWSTD_FORWARD(_TypeT, __x) _STD::forward<_TypeT> (__x)
# define _RWSTD_MOVE(__x) _STD::move (__x)
# else // no rvalue references
-# define _RWSTD_FORWARD(_Type, __x) (__x)
+# define _RWSTD_FORWARD(_TypeT, __x) (__x)
# define _RWSTD_MOVE(__x) (__x)
# endif // !defined _RWSTD_NO_RVALUE_REFERENCES
Modified: stdcxx/branches/4.3.x/include/rw/_ref_wrap.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/rw/_ref_wrap.h?rev=673534&r1=673533&r2=673534&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_ref_wrap.h (original)
+++ stdcxx/branches/4.3.x/include/rw/_ref_wrap.h Wed Jul 2 15:49:15 2008
@@ -41,14 +41,14 @@
// 20.5.5, class template reference_wrapper:
-template <class _Type>
+template <class _TypeT>
class reference_wrapper
{
- _Type* _C_ptr;
+ _TypeT* _C_ptr;
public:
- typedef _Type type;
+ typedef _TypeT type;
reference_wrapper (type& __x)
: _C_ptr (&__x) { /* empty */ }
@@ -74,33 +74,33 @@
};
-template <class _Type>
-inline reference_wrapper<_Type>
-ref (_Type& __x)
+template <class _TypeT>
+inline reference_wrapper<_TypeT>
+ref (_TypeT& __x)
{
- return reference_wrapper<_Type> (__x);
+ return reference_wrapper<_TypeT> (__x);
}
-template <class _Type>
-inline reference_wrapper<_Type>
-ref (reference_wrapper<_Type>& __x)
+template <class _TypeT>
+inline reference_wrapper<_TypeT>
+ref (reference_wrapper<_TypeT>& __x)
{
- return reference_wrapper<_Type> (__x);
+ return reference_wrapper<_TypeT> (__x);
}
-template <class _Type>
-inline reference_wrapper<const _Type>
-cref (const _Type& __x)
+template <class _TypeT>
+inline reference_wrapper<const _TypeT>
+cref (const _TypeT& __x)
{
- return reference_wrapper<const _Type> (__x);
+ return reference_wrapper<const _TypeT> (__x);
}
-template <class _Type>
-inline reference_wrapper<const _Type>
-cref (reference_wrapper<const _Type>& __x)
+template <class _TypeT>
+inline reference_wrapper<const _TypeT>
+cref (reference_wrapper<const _TypeT>& __x)
{
- return reference_wrapper<const _Type> (__x);
+ return reference_wrapper<const _TypeT> (__x);
}
Modified: stdcxx/branches/4.3.x/include/rw/_tuple.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/rw/_tuple.h?rev=673534&r1=673533&r2=673534&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_tuple.h (original)
+++ stdcxx/branches/4.3.x/include/rw/_tuple.h Wed Jul 2 15:49:15 2008
@@ -55,7 +55,7 @@
# if !defined _RWSTD_NO_VARIADIC_TEMPLATES
-template <class... _Types>
+template <class... _TypesT>
class __rw_tuple;
_RWSTD_SPECIALIZED_CLASS
@@ -177,28 +177,28 @@
struct __rw_ignore { /* empty */ };
-template <class _Type>
+template <class _TypeT>
struct __rw_deduce_ref
{
- typedef _Type _C_type;
+ typedef _TypeT _C_type;
};
-template <class _Type>
-struct __rw_deduce_ref<_STD::reference_wrapper<_Type> >
+template <class _TypeT>
+struct __rw_deduce_ref<_STD::reference_wrapper<_TypeT> >
{
- typedef _Type& _C_type;
+ typedef _TypeT& _C_type;
};
-template <class _Type>
-struct __rw_deduce_ref<const _STD::reference_wrapper<_Type> >
+template <class _TypeT>
+struct __rw_deduce_ref<const _STD::reference_wrapper<_TypeT> >
{
- typedef _Type& _C_type;
+ typedef _TypeT& _C_type;
};
-template <class _Type>
+template <class _TypeT>
struct __rw_make_tuple
{
- typedef _TYPENAME _RWSTD_DECAY (_Type) _C_decay;
+ typedef _TYPENAME _RWSTD_DECAY (_TypeT) _C_decay;
typedef _TYPENAME __rw_deduce_ref<_C_decay>::_C_type _C_type;
};
@@ -236,4 +236,3 @@
#endif // _RWSTD_TUPLE_INCLUDED
-
Modified: stdcxx/branches/4.3.x/include/tuple
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/tuple?rev=673534&r1=673533&r2=673534&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/tuple (original)
+++ stdcxx/branches/4.3.x/include/tuple Wed Jul 2 15:49:15 2008
@@ -52,7 +52,7 @@
// 20.3.1, class template tuple:
-template <class... _Types>
+template <class... _TypesT>
class tuple;
_RWSTD_SPECIALIZED_CLASS
@@ -75,6 +75,9 @@
tuple ()
: _Base () { /* empty */ }
+ // employ _RWSTD_STATIC_CAST to ensure compiler binds to correct
+ // base class ctors and operators
+
tuple (const tuple& __tuple)
: _Base (_RWSTD_STATIC_CAST (const _Base&, __tuple)) { /* empty */ }
@@ -264,8 +267,8 @@
template <class _Type, class _Alloc>
struct uses_allocator;
-template <class... _Types, class _Alloc>
-struct uses_allocator<tuple<_Types...>, _Alloc>
+template <class... _TypesT, class _Alloc>
+struct uses_allocator<tuple<_TypesT...>, _Alloc>
: _RW::__rw_true_type
{
// empty
@@ -275,8 +278,8 @@
template <class _Type>
struct constructible_with_allocator_prefix;
-template <class... _Types>
-struct constructible_with_allocator_prefix<tuple<_Types...> >
+template <class... _TypesT>
+struct constructible_with_allocator_prefix<tuple<_TypesT...> >
: _RW::__rw_true_type
{
// empty
@@ -290,12 +293,12 @@
# if !defined _RWSTD_NO_RVALUE_REFERENCES
-template <class... _Types>
-tuple<_TYPENAME _RW::__rw_make_tuple<_Types>::_C_type...>
-make_tuple (_Types&&... __values)
+template <class... _TypesT>
+tuple<_TYPENAME _RW::__rw_make_tuple<_TypesT>::_C_type...>
+make_tuple (_TypesT&&... __values)
{
- typedef tuple<_TYPENAME _RW::__rw_make_tuple<_Types>::_C_type...> _Tuple;
- return _Tuple (_RWSTD_FORWARD (_Types, __values)...);
+ typedef tuple<_TYPENAME _RW::__rw_make_tuple<_TypesT>::_C_type...> _Tuple;
+ return _Tuple (_RWSTD_FORWARD (_TypesT, __values)...);
}
@@ -322,25 +325,25 @@
const tuple<_TypesU...>& __y);
-template <class... _Types>
-tuple<_Types&...> tie (_Types&...);
+template <class... _TypesT>
+tuple<_TypesT&...> tie (_TypesT&...);
// 20.3.1.4, tuple helper classes:
-template <class _Types>
+template <class _TypesT>
class tuple_size;
-template <class... _Types>
-class tuple_size< tuple<_Types...> >
+template <class... _TypesT>
+class tuple_size< tuple<_TypesT...> >
: public _RW::__rw_integral_constant< _RWSTD_SIZE_T,
- sizeof... (_Types) >
+ sizeof... (_TypesT) >
{
// empty
};
-template <int _Index, class... _Types>
+template <_RWSTD_SIZE_T _Index, class... _TypesT>
struct tuple_element;
template <class _Head, class... _Tail>
@@ -363,7 +366,7 @@
_C_get (const _Tuple& __tuple) { return __tuple._C_head (); }
};
-template <int _Index, class _Head, class... _Tail>
+template <_RWSTD_SIZE_T _Index, class _Head, class... _Tail>
struct tuple_element<_Index, tuple<_Head, _Tail...> >
: public tuple_element<_Index - 1, tuple<_Tail...> >
{
@@ -373,7 +376,7 @@
// 20.3.1.5, element access:
-template <int _Index, class _Head, class... _Tail>
+template <_RWSTD_SIZE_T _Index, class _Head, class... _Tail>
_TYPENAME tuple_element<_Index, tuple<_Head, _Tail...> >::_Ref
get (tuple<_Head, _Tail...>& __tuple)
{
@@ -381,7 +384,7 @@
return _Tuple::_C_get (__tuple);
}
-template <int _Index, class _Head, class... _Tail>
+template <_RWSTD_SIZE_T _Index, class _Head, class... _Tail>
_TYPENAME tuple_element<_Index, tuple<_Head, _Tail...> >::_ConstRef
get (const tuple<_Head, _Tail...>& __tuple)
{