stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elemi...@apache.org
Subject svn commit: r672948 - in /stdcxx/branches/4.3.x: include/ include/rw/ tests/utilities/
Date Mon, 30 Jun 2008 22:40:19 GMT
Author: elemings
Date: Mon Jun 30 15:40:18 2008
New Revision: 672948

URL: http://svn.apache.org/viewvc?rev=672948&view=rev
Log:
2008-06-30  Eric Lemings <eric.lemings@roguewave.com>

	STDCXX-958
	* include/rw/_forward.h: Add additional macro functions for
	consistency.  Use consistent comment format for standard section
	references.  Utilize type trait macro.  Other minor changes in
	copyright notice.
	* include/rw/_ref_wrap.h: Add standard section reference comment.
	Remove explicit template parameter names within class template.
	Add _RWSTD_ASSERT() statements where appropriate.  Replaced
	template parameter name with public typedef name inside class
	template.
	* include/rw/_tuple_traits.h: Removed.  Incorporated directly
	into <tuple> header.
	* include/rw/_tuple.h: Added internal tuple class template and
	make_tuple helpers.  Utilize _RWSTD_FORWARD() function macro.
	* include/tuple: Minor changes in header comment.  Moved internal
	members to <rw/_tuple.h> header.  Include <rw/_forward.h> and
	utilize _RWSTD_FORWARD() and _RWSTD_MOVE macro functions.
	Inherit class template `std::tuple' from internal `__rw_tuple'
	class template.  Reworked pair specialization to also inherit
	from internal tuple.  Add `_BaseU' macro definition for use in
	_RWSTD_STATIC_CAST where type contains commas (which won't work
	in static_cast when expanded).
	(tuple_element): Updated get helpers in std::tuple_element class
	template with internal type trait macros.  
	(get): Fixed.
	(make_tuple(), operator==, operator<): Implemented.
	* tests/utilities/20.tuple.cnstr.cpp: Updated previously broken
	tests.
	* tests/utilities/20.tuple.helpers.cpp: Minor changes (copyright
	notice).
	* tests/utilities/20.tuple.h: Same.
	* tests/utilities/20.tuple.creation.cpp: Added new test program
	for tuple creation helpers.
	* tests/utilities/20.tuple.rel.cpp: Added (outline of) new test
	program
	* tests/utilities/20.tuple.elem.cpp: Added more const/mutable
	tests.


Added:
    stdcxx/branches/4.3.x/tests/utilities/20.tuple.creation.cpp   (with props)
    stdcxx/branches/4.3.x/tests/utilities/20.tuple.rel.cpp   (with props)
Removed:
    stdcxx/branches/4.3.x/include/rw/_tuple_traits.h
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
    stdcxx/branches/4.3.x/tests/utilities/20.forward.cpp
    stdcxx/branches/4.3.x/tests/utilities/20.tuple.cnstr.cpp
    stdcxx/branches/4.3.x/tests/utilities/20.tuple.elem.cpp
    stdcxx/branches/4.3.x/tests/utilities/20.tuple.h
    stdcxx/branches/4.3.x/tests/utilities/20.tuple.helpers.cpp

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=672948&r1=672947&r2=672948&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_forward.h (original)
+++ stdcxx/branches/4.3.x/include/rw/_forward.h Mon Jun 30 15:40:18 2008
@@ -3,6 +3,9 @@
  *
  * _forward - forward/move helpers for <utility> header
  *
+ * This is an internal header file used to implement the C++ Standard
+ * Library. It should never be #included directly by a program.
+ *
  * $Id$
  *
  ***************************************************************************
@@ -23,7 +26,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2008 Rogue Wave Software.
+ * Copyright 2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -40,8 +43,9 @@
 _RWSTD_NAMESPACE (std) {
 
 
-// [20.2.2]  forward/move helpers
+// 20.2.2, forward/move helpers:
 
+_EXPORT
 template <class _Type>
 struct identity
 {
@@ -52,6 +56,8 @@
     }
 };
 
+#    define _RWSTD_IDENTITY(_Type)          _STD::identity<_Type>::type
+
 
 #    if !defined _RWSTD_NO_RVALUE_REFERENCES
 
@@ -63,17 +69,22 @@
     return __x;
 }
 
+
 _EXPORT
 template <class _Type>
-_TYPENAME _RW::__rw_remove_reference<_Type>::type&&
+_TYPENAME _RWSTD_REMOVE_REFERENCE(_Type)&&
 move (_Type&& __x)
 {
     return __x;
 }
 
-#      define _RWSTD_MOVE(__x)   std::move (__x)
+#      define _RWSTD_FORWARD(_Type, __x)    _STD::forward<_Type> (__x)
+#      define _RWSTD_MOVE(__x)              std::move (__x)
+
 #    else   // no rvalue references
-#      define _RWSTD_MOVE(__x)   (__x)
+
+#      define _RWSTD_FORWARD(_Type, __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=672948&r1=672947&r2=672948&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_ref_wrap.h (original)
+++ stdcxx/branches/4.3.x/include/rw/_ref_wrap.h Mon Jun 30 15:40:18 2008
@@ -1,6 +1,8 @@
 // -*- C++ -*-
 /***************************************************************************
  *
+ * _ref_wrap.h - reference wrappers for <functional> header
+ *
  * This is an internal header file used to implement the C++ Standard
  * Library. It should never be #included directly by a program.
  *
@@ -39,6 +41,8 @@
 _RWSTD_NAMESPACE (std) {
 
 
+// 20.5.5, class template reference_wrapper:
+
 template <class _Type>
 class reference_wrapper
 {
@@ -48,20 +52,27 @@
 
     typedef _Type type;
 
-    reference_wrapper (_Type& __x)
+    reference_wrapper (type& __x)
         : _C_ptr (&__x) { /* empty */ }
 
-    reference_wrapper (const reference_wrapper<_Type>& __x)
+    reference_wrapper (const reference_wrapper& __x)
         : _C_ptr (__x._C_ptr) { /* empty */ }
 
-    reference_wrapper& operator= (const reference_wrapper<_Type>& __x) {
+    reference_wrapper& operator= (const reference_wrapper& __x) {
+        _RWSTD_ASSERT (0 != __x._C_ptr);
         _C_ptr = __x._C_ptr;
         return *this;
     }
 
-    operator _Type& () const { return *_C_ptr; }
+    operator type& () const {
+        _RWSTD_ASSERT (0 != _C_ptr);
+        return *_C_ptr;
+    }
 
-    _Type& get() const { return *_C_ptr; }
+    type& get() const {
+        _RWSTD_ASSERT (0 != _C_ptr);
+        return *_C_ptr;
+    }
 };
 
 

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=672948&r1=672947&r2=672948&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_tuple.h (original)
+++ stdcxx/branches/4.3.x/include/rw/_tuple.h Mon Jun 30 15:40:18 2008
@@ -1,7 +1,7 @@
 // -*- C++ -*-
 /***************************************************************************
  *
- * _tuple.h - tuple class template and specializations
+ * _tuple.h - internal class template and helpers for <tuple> header
  *
  * This is an internal header file used to implement the C++ Standard
  * Library. It should never be #included directly by a program.
@@ -26,7 +26,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2008 Rogue Wave Software.
+ * Copyright 2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -38,211 +38,196 @@
 #  if !defined _RWSTD_NO_EXT_CXX_0X
 
 #    include <rw/_allocator.h>      // for std::allocator_arg_t
-#    include <rw/_forward.h>        // for std::forward, _RWSTD_MOVE
-#    include <rw/_pair.h>           // for std::pair
+#    include <rw/_forward.h>        // for _RWSTD_FORWARD, _RWSTD_MOVE
+#    include <rw/_ref_wrap.h>       // for std::reference_wrapper
 
 
-#    if !defined _RWSTD_NO_VARIADIC_TEMPLATES
+_RWSTD_NAMESPACE (__rw) {
 
-_RWSTD_NAMESPACE (std) {
 
+// internal tuple class template
 
-// 20.3.1, class template tuple:
+#    if !defined _RWSTD_NO_VARIADIC_TEMPLATES
 
-template < class... Types >
-class tuple;
+template <class... _Types>
+class __rw_tuple;
 
 _RWSTD_SPECIALIZED_CLASS
-class tuple< >
+class __rw_tuple<>
 {
     // empty
 };
 
-template < class _HeadT, class... _TailT >
-class tuple< _HeadT, _TailT... >
-    : public tuple< _TailT... >
+template <class _HeadT, class... _TailT>
+class __rw_tuple<_HeadT, _TailT...>
+    : public __rw_tuple<_TailT...>
 {
-    typedef tuple< _TailT... >  _Base;
-
-//protected:
+    typedef __rw_tuple<_TailT...>   _Base;
 
-    _HeadT        _C_head;
-
-    _Base&        _C_tail ()       { return *this; }
-    const _Base&  _C_tail () const { return *this; }
+    _HeadT  _C_data;
 
 public:
 
-    _HeadT&       __get ()       { return _C_head; }
-    const _HeadT& __get () const { return _C_head; }
-
-    tuple ()
-        : _Base (), _C_head () { /* empty */ }
+    __rw_tuple ()
+        : _Base (), _C_data () { /* empty */ }
 
-    tuple (const tuple& __tuple)
+    __rw_tuple (const __rw_tuple& __tuple)
         : _Base (__tuple._C_tail ())
-        , _C_head (__tuple._C_head) { /* empty */ }
+        , _C_data (__tuple._C_data) { /* empty */ }
 
-    tuple& operator= (const tuple& __tuple) {
+    __rw_tuple& operator= (const __rw_tuple& __tuple) {
         _Base::operator= (__tuple._C_tail ());
-        _C_head = __tuple._C_head;
+        _C_data = __tuple._C_data;
         return *this;
     }
 
     _EXPLICIT
-    tuple (const _HeadT& __head, const _TailT&... __tail)
-        : _Base (__tail...), _C_head (__head) { /* empty */ }
-
-#      if !defined _RWSTD_NO_RVALUE_REFERENCES
-
-    tuple (tuple&& __tuple)
-        : _Base (std::forward<_Base> (__tuple._C_tail ()))
-        , _C_head (_RWSTD_MOVE (__tuple._C_head)) { /* empty */ }
-
-    tuple& operator= (tuple&& __tuple) {
-        _Base::operator= (std::forward<_Base> (__tuple._C_tail ()));
-        _C_head = _RWSTD_MOVE (__tuple._C_head);
-        return *this;
-    }
-
-#      endif   // !defined _RWSTD_NO_RVALUE_REFERENCES
+    __rw_tuple (const _HeadT& __head, const _TailT&... __tail)
+        : _Base (__tail...), _C_data (__head) { /* empty */ }
 
     template <class _HeadU, class... _TailU>
-    tuple (const tuple<_HeadU, _TailU...>& __tuple)
+    __rw_tuple (const __rw_tuple<_HeadU, _TailU...>& __tuple)
         : _Base (__tuple._C_tail ())
-        , _C_head (__tuple._C_head) { /* empty */ }
+        , _C_data (__tuple._C_head ()) { /* empty */ }
 
     template <class _HeadU, class... _TailU>
-    tuple& operator= (const tuple<_HeadU, _TailU...>& __tuple) {
+    __rw_tuple& operator= (const __rw_tuple<_HeadU, _TailU...>& __tuple) {
         _Base::operator= (__tuple._C_tail ());
-        _C_head = __tuple._C_head;
+        _C_data = __tuple._C_head ();
         return *this;
     }
 
 #      if !defined _RWSTD_NO_RVALUE_REFERENCES
 
+    __rw_tuple (__rw_tuple&& __tuple)
+        : _Base (_RWSTD_FORWARD (_Base, __tuple._C_tail ()))
+        , _C_data (_RWSTD_MOVE (__tuple._C_data)) { /* empty */ }
+
+    __rw_tuple& operator= (__rw_tuple&& __tuple) {
+        _Base::operator= (_RWSTD_FORWARD (_Base, __tuple._C_tail ()));
+        _C_data = _RWSTD_MOVE (__tuple._C_data);
+        return *this;
+    }
+
     template <class _HeadU, class... _TailU>
-    _EXPLICIT tuple (_HeadU&& __head, _TailU&&... __tail)
-        : _Base (std::forward<_TailU> (__tail)...)
-        , _C_head (_RWSTD_MOVE (__head)) { /* empty */ }
+    _EXPLICIT __rw_tuple (_HeadU&& __head, _TailU&&... __tail)
+        : _Base (_RWSTD_FORWARD (_TailU, __tail)...)
+        , _C_data (_RWSTD_MOVE (__head)) { /* empty */ }
 
     template <class _HeadU, class... _TailU>
-    tuple (tuple<_HeadU, _TailU...>&& __tuple)
-        : _Base (std::forward<_Base> (__tuple._C_tail ()))
-        , _C_head (_RWSTD_MOVE (__tuple._C_head)) { /* empty */ }
+    __rw_tuple (__rw_tuple<_HeadU, _TailU...>&& __tuple)
+        : _Base (_RWSTD_FORWARD (_Base, __tuple._C_tail ()))
+        , _C_data (_RWSTD_MOVE (__tuple._C_head ())) { /* empty */ }
 
     template <class _HeadU, class... _TailU>
-    tuple& operator= (tuple<_HeadU, _TailU...>&& __tuple) {
-        _Base::operator= (std::forward<_Base> (__tuple._C_tail ()));
-        _C_head = _RWSTD_MOVE (__tuple._C_head);
+    __rw_tuple& operator= (__rw_tuple<_HeadU, _TailU...>&& __tuple) {
+        _Base::operator= (_RWSTD_FORWARD (_Base, __tuple._C_tail ()));
+        _C_data = _RWSTD_MOVE (__tuple._C_head ());
         return *this;
     }
 
     // allocator-extended constructors:
 
     template <class _Alloc, class... _TypesU>
-    tuple (allocator_arg_t, const _Alloc& __alloc,
-           const _TypesU&&... __values);
+    __rw_tuple (_STD::allocator_arg_t, const _Alloc& __alloc,
+                const _TypesU&&... __values);
 
     template <class _Alloc>
-    tuple (allocator_arg_t, const _Alloc& __alloc,
-           tuple&& __tuple);
+    __rw_tuple (_STD::allocator_arg_t, const _Alloc& __alloc,
+                __rw_tuple&& __tuple);
 
     template <class _Alloc, class... _TypesU>
-    tuple (allocator_arg_t, const _Alloc& __alloc,
-           tuple<_TypesU...>&& __tuple);
+    __rw_tuple (_STD::allocator_arg_t, const _Alloc& __alloc,
+                __rw_tuple<_TypesU...>&& __tuple);
 
 #      endif   // !defined _RWSTD_NO_RVALUE_REFERENCES
 
     template <class _Alloc>
-    tuple (allocator_arg_t, const _Alloc& __alloc);
+    __rw_tuple (_STD::allocator_arg_t, const _Alloc& __alloc);
 
     template <class _Alloc>
-    tuple (allocator_arg_t, const _Alloc& __alloc,
+    __rw_tuple (_STD::allocator_arg_t, const _Alloc& __alloc,
            const _HeadT& __head, const _TailT&... __tail);
 
     template <class _Alloc>
-    tuple (allocator_arg_t, const _Alloc& __alloc,
-           const tuple& __tuple);
+    __rw_tuple (_STD::allocator_arg_t, const _Alloc& __alloc,
+                const __rw_tuple& __tuple);
 
     template <class _Alloc, class... _TypesU>
-    tuple (allocator_arg_t, const _Alloc& __alloc,
-           const tuple<_TypesU...>& __tuple);
-
-};
-
+    __rw_tuple (_STD::allocator_arg_t, const _Alloc& __alloc,
+                const __rw_tuple<_TypesU...>& __tuple);
 
-template < class _TypeT1, class _TypeT2 >
-class tuple< _TypeT1, _TypeT2 >
-{
-    _TypeT1 _C_first;
-    _TypeT2 _C_second;
-
-public:
+    // accessors:
 
-    tuple (): _C_first (), _C_second () { /* empty */ }
+    _HeadT&         _C_head ()       { return _C_data; }
+    const _HeadT&   _C_head () const { return _C_data; }
 
-    tuple (const tuple& __tuple)
-        : _C_first (__tuple._C_first)
-        , _C_second (__tuple._C_second) { /* empty */ }
-
-    tuple& operator= (const tuple& __tuple) {
-        _C_first = __tuple._C_first;
-        _C_second = __tuple._C_second;
-        return *this;
-    }
+    _Base&          _C_tail ()       { return *this; }
+    const _Base&    _C_tail () const { return *this; }
 
-    _EXPLICIT tuple (const _TypeT1& __t1, const _TypeT2& __t2)
-        : _C_first (__t1), _C_second (__t2) { /* empty */ }
+};
 
-    template <class _TypeU1, class _TypeU2>
-    tuple (const pair<_TypeU1, _TypeU2>& __pair)
-        : _C_first (__pair.first), _C_second (__pair.second) { /* empty */ }
-
-    template <class _TypeU1, class _TypeU2>
-    tuple& operator= (const pair<_TypeU1, _TypeU2>& __pair) {
-        _C_first = __pair.first;
-        _C_second = __pair.second;
-        return *this;
-    }
 
-#      if !defined _RWSTD_NO_RVALUE_REFERENCES
+struct __rw_ignore { /* empty */ };
 
-    template <class _TypeU1, class _TypeU2>
-    tuple (pair<_TypeU1, _TypeU2>&& __pair)
-        : _C_first (_RWSTD_MOVE (__pair.first))
-        , _C_second (_RWSTD_MOVE (__pair.second)) { /* empty */ }
-
-    template <class _TypeU1, class _TypeU2>
-    tuple& operator= (pair<_TypeU1, _TypeU2>&& __pair) {
-        _C_first = _RWSTD_MOVE (__pair.first);
-        _C_second = _RWSTD_MOVE (__pair.second);
-        return *this;
-    }
 
-    // allocator-extended constructors:
+template <class _Type>
+struct __rw_deduce_ref
+{
+    typedef _Type   _C_type;
+};
 
-    template <class _Alloc, class _TypeU1, class _TypeU2>
-    tuple (allocator_arg_t, const _Alloc& __alloc,
-           pair<_TypeU1, _TypeU2>&& __pair);
+template <class _Type>
+struct __rw_deduce_ref<_STD::reference_wrapper<_Type> >
+{
+    typedef _Type&  _C_type;
+};
 
-#      endif   // !defined _RWSTD_NO_RVALUE_REFERENCES
+template <class _Type>
+struct __rw_deduce_ref<const _STD::reference_wrapper<_Type> >
+{
+    typedef _Type&  _C_type;
+};
 
-    template <class _Alloc, class _TypeU1, class _TypeU2>
-    tuple (allocator_arg_t, const _Alloc& __alloc,
-           const pair<_TypeU1, _TypeU2>& __pair);
+template <class _Type>
+struct __rw_make_tuple
+{
+    typedef _TYPENAME _RWSTD_DECAY (_Type)                  _C_decay;
+    typedef _TYPENAME __rw_deduce_ref<_C_decay>::_C_type    _C_type;
+};
 
-public: // internal
 
-    _TypeT1&        __get ()       { return _C_first; }
-    const _TypeT1&  __get () const { return _C_first; }
+template <class...  _TypesT, class... _TypesU>
+bool operator== (const __rw_tuple<_TypesT...>& __x,
+                 const __rw_tuple<_TypesU...>& __y) {
+    return (__x._C_head () == __y._C_head ())
+            && (__x._C_tail () == __y._C_tail ());
+}
+
+_RWSTD_SPECIALIZED_FUNCTION
+bool operator== (const __rw_tuple<>& /*__x*/,
+                 const __rw_tuple<>& /*__y*/) {
+    return true;
+}
+
+template <class...  _TypesT, class... _TypesU>
+bool operator< (const __rw_tuple<_TypesT...>& __x,
+                const __rw_tuple<_TypesU...>& __y) {
+    return (__x._C_head () < __y._C_head ())
+            || (__y._C_tail () < __x._C_tail ());
+}
+
+_RWSTD_SPECIALIZED_FUNCTION
+bool operator< (const __rw_tuple<>& /*__x*/,
+                const __rw_tuple<>& /*__y*/) {
+    return false;
+}
 
-};
+#    endif   // !defined _RWSTD_NO_VARIADIC_TEMPLATES
 
 
-}   // namespace std
+}   // namespace __rw
 
-#    endif   // !defined _RWSTD_NO_VARIADIC_TEMPLATES
 
 #  endif   // !defined _RWSTD_NO_EXT_CXX_0X
 

Modified: stdcxx/branches/4.3.x/include/tuple
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/tuple?rev=672948&r1=672947&r2=672948&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/tuple (original)
+++ stdcxx/branches/4.3.x/include/tuple Mon Jun 30 15:40:18 2008
@@ -1,7 +1,7 @@
 // -*- C++ -*-
 /***************************************************************************
  *
- * tuple - fixed-size collection of values with variable, heterogenous types
+ * tuple - fixed-size collections with variable, heterogenous types
  *
  * $Id$
  *
@@ -23,8 +23,8 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2008 Rogue Wave Software.
- * 
+ * Copyright 2008 Rogue Wave Software, Inc.
+ *
  **************************************************************************/
 
 #ifndef _RWSTD_TUPLE_INCLUDED
@@ -38,63 +38,265 @@
 
 #  include <type_traits>
 
-#  include <rw/_ref_wrap.h>
-
+#  include <rw/_forward.h>
+#  include <rw/_pair.h>
 #  include <rw/_tuple.h>
-#  include <rw/_tuple_traits.h>
+
+#  if !defined _RWSTD_NO_VARIADIC_TEMPLATES
 
 
-_RWSTD_NAMESPACE (__rw) {
+_RWSTD_NAMESPACE (std) {
 
-struct __rw_ignore { /* empty */ };
 
-template <class _Type>
-struct __rw_deduce_reference
+// 20.3.1, class template tuple:
+
+template <class... _Types>
+class tuple;
+
+_RWSTD_SPECIALIZED_CLASS
+class tuple<>
 {
-    typedef _Type type;
+    // empty
 };
 
-template <class _Type>
-struct __rw_deduce_reference< __rw_ref_wrap<_Type> >
+template <class... _TypesT>
+class tuple
+    : public _RW::__rw_tuple<_TypesT...>
 {
-    typedef _Type& type;
+    typedef _RW::__rw_tuple<_TypesT...> _Base;
+
+#    undef _BaseU
+#    define _BaseU  _RW::__rw_tuple<_TypesU...>
+
+public:
+
+    tuple ()
+        : _Base () { /* empty */ }
+
+    tuple (const tuple& __tuple)
+        : _Base (_RWSTD_STATIC_CAST (const _Base&, __tuple)) { /* empty */ }
+
+    tuple& operator= (const tuple& __tuple) {
+        _Base::operator= (_RWSTD_STATIC_CAST (const _Base&, __tuple));
+        return *this;
+    }
+
+    _EXPLICIT
+    tuple (const _TypesT&... __values)
+        : _Base (__values...) { /* empty */ }
+
+    template <class... _TypesU>
+    tuple (const tuple<_TypesU...>& __tuple)
+        : _Base (_RWSTD_STATIC_CAST (const _BaseU&, __tuple)) { /* empty */ }
+
+    template <class... _TypesU>
+    tuple& operator= (const tuple<_TypesU...>& __tuple) {
+        _Base::operator= (_RWSTD_STATIC_CAST (const _BaseU&, __tuple));
+        return *this;
+    }
+
+#    if !defined _RWSTD_NO_RVALUE_REFERENCES
+
+    //tuple (tuple&& __tuple)
+        //: _Base (_RWSTD_FORWARD (_Base, __tuple)) { /* empty */ }
+
+    tuple& operator= (tuple&& __tuple) {
+        _Base::operator= (_RWSTD_FORWARD (_Base, __tuple));
+        return *this;
+    }
+
+    template <class... _TypesU>
+    _EXPLICIT tuple (_TypesU&&... __values)
+        : _Base (_RWSTD_FORWARD (_TypesU, __values)...) { /* empty */ }
+
+    //template <class... _TypesU>
+    //tuple (tuple<_TypesU...>&& __tuple)
+        //: _Base (_RWSTD_FORWARD (_BaseU, __tuple)) { /* empty */ }
+
+    template <class... _TypesU>
+    tuple& operator= (tuple<_TypesU...>&& __tuple) {
+        _Base::operator= (_RWSTD_FORWARD (_BaseU, __tuple));
+        return *this;
+    }
+
+    // allocator-extended constructors:
+
+    template <class _Alloc, class... _TypesU>
+    tuple (allocator_arg_t, const _Alloc& __alloc,
+           const _TypesU&&... __values);
+
+    template <class _Alloc>
+    tuple (allocator_arg_t, const _Alloc& __alloc,
+           tuple&& __tuple);
+
+    template <class _Alloc, class... _TypesU>
+    tuple (allocator_arg_t, const _Alloc& __alloc,
+           tuple<_TypesU...>&& __tuple);
+
+#    endif   // !defined _RWSTD_NO_RVALUE_REFERENCES
+
+#    undef _BaseU
+
+    template <class _Alloc>
+    tuple (allocator_arg_t, const _Alloc& __alloc);
+
+    template <class _Alloc>
+    tuple (allocator_arg_t, const _Alloc& __alloc,
+           const _TypesT&... __values);
+
+    template <class _Alloc>
+    tuple (allocator_arg_t, const _Alloc& __alloc,
+           const tuple& __tuple);
+
+    template <class _Alloc, class... _TypesU>
+    tuple (allocator_arg_t, const _Alloc& __alloc,
+           const tuple<_TypesU...>& __tuple);
+
 };
 
-template <class _Type>
-struct __rw_deduce_reference< const __rw_ref_wrap<_Type> >
+
+template <class _TypeT1, class _TypeT2>
+class tuple<_TypeT1, _TypeT2>
+    : public _RW::__rw_tuple<_TypeT1, _TypeT2>
 {
-    typedef _Type& type;
+    typedef _RW::__rw_tuple<_TypeT1, _TypeT2>   _Base;
+
+#    undef _BaseU
+#    define _BaseU  _RW::__rw_tuple<_TypeU1, _TypeU2>
+
+public:
+
+    // 20.3.1.2, construction:
+
+    tuple ()
+        : _Base () { /* empty */ }
+
+    tuple (const tuple& __tuple)
+        : _Base (_RWSTD_STATIC_CAST (const _Base&, __tuple)) { /* empty */ }
+
+    tuple& operator= (const tuple& __tuple) {
+        _Base::operator= (_RWSTD_STATIC_CAST (const _Base&, __tuple));
+        return *this;
+    }
+
+    _EXPLICIT
+    tuple (const _TypeT1& __x, const _TypeT2& __y)
+        : _Base (__x, __y) { /* empty */ }
+
+    template <class _TypeU1, class _TypeU2>
+    tuple (const tuple<_TypeU1, _TypeU2>& __tuple)
+        : _Base (_RWSTD_STATIC_CAST (const _BaseU&, __tuple)) { /* empty */ }
+
+    template <class _TypeU1, class _TypeU2>
+    tuple& operator= (const tuple<_TypeU1, _TypeU2>& __tuple) {
+        _Base::operator= (_RWSTD_STATIC_CAST (const _BaseU&, __tuple));
+        return *this;
+    }
+
+    template <class _TypeU1, class _TypeU2>
+    tuple (const pair<_TypeU1, _TypeU2>& __pair)
+        : _Base (__pair.first, __pair.second) { /* empty */ }
+
+    template <class _TypeU1, class _TypeU2>
+    tuple& operator= (const pair<_TypeU1, _TypeU2>& __pair) {
+        _Base::operator= (__pair.first, __pair.second);
+        return *this;
+    }
+
+#    if !defined _RWSTD_NO_RVALUE_REFERENCES
+
+    template <class _TypeU1, class _TypeU2>
+    _EXPLICIT tuple (_TypeU1&& __x, _TypeU2 __y)
+        : _Base (_RWSTD_FORWARD (_TypeU1, __x),
+                 _RWSTD_FORWARD (_TypeU2, __y)) { /* empty */ }
+
+    tuple (tuple&& __tuple)
+        : _Base (_RWSTD_FORWARD (_Base, __tuple)) { /* empty */ }
+
+    tuple& operator= (tuple&& __tuple) {
+        _Base::operator= (_RWSTD_FORWARD (_Base, __tuple));
+        return *this;
+    }
+
+    template <class _TypeU1, class _TypeU2>
+    tuple (tuple<_TypeU1, _TypeU2>&& __tuple)
+        : _Base (_RWSTD_FORWARD (_BaseU, __tuple))
+    { /* empty */ }
+
+    template <class _TypeU1, class _TypeU2>
+    tuple& operator= (tuple<_TypeU1, _TypeU2>&& __tuple) {
+        _Base::operator= (_RWSTD_FORWARD (_BaseU, __tuple));
+        return *this;
+    }
+
+    template <class _TypeU1, class _TypeU2>
+    tuple (pair<_TypeU1, _TypeU2>&& __pair)
+        : _Base (_RWSTD_MOVE (__pair.first),
+                 _RWSTD_MOVE ( __pair.second)) { /* empty */ }
+
+    template <class _TypeU1, class _TypeU2>
+    tuple& operator= (pair<_TypeU1, _TypeU2>&& __pair) {
+        _Base::operator= (__pair.first, __pair.second);
+        return *this;
+    }
+
+    // allocator-extended constructors:
+
+    template <class _Alloc, class _TypeU1, class _TypeU2>
+    tuple (allocator_arg_t, const _Alloc& __alloc,
+           pair<_TypeU1, _TypeU2>&& __pair);
+
+#    endif   // !defined _RWSTD_NO_RVALUE_REFERENCES
+
+#    undef _BaseU
+
+    template <class _Alloc, class _TypeU1, class _TypeU2>
+    tuple (allocator_arg_t, const _Alloc& __alloc,
+           const pair<_TypeU1, _TypeU2>& __pair);
+
 };
 
-template <class _Type>
-class __rw_make_tuple
+
+// 20.3.1.1, tuple traits:
+
+template <class _Type, class _Alloc>
+struct uses_allocator;
+
+template <class... _Types, class _Alloc>
+struct uses_allocator<tuple<_Types...>, _Alloc>
+    : _RW::__rw_true_type
 {
-    typedef _TYPENAME _RWSTD_DECAY(_Type) _Decay;
-    typedef _TYPENAME __rw_deduce_reference<_Decay>::type type;
+    // empty
 };
 
-}   // namespace __rw
 
+template <class _Type>
+struct constructible_with_allocator_prefix;
 
-_RWSTD_NAMESPACE (std) {
+template <class... _Types>
+struct constructible_with_allocator_prefix<tuple<_Types...> >
+    : _RW::__rw_true_type
+{
+    // empty
+};
 
 
 // 20.3.3, tuple creation functions:
 
 const _RW::__rw_ignore ignore = _RW::__rw_ignore ();
 
-#  if !defined _RWSTD_NO_VARIADIC_TEMPLATES
 
 #    if !defined _RWSTD_NO_RVALUE_REFERENCES
 
 template <class... _Types>
-tuple<_TYPENAME _RW::__rw_make_tuple<_Types>::type...>
+tuple<_TYPENAME _RW::__rw_make_tuple<_Types>::_C_type...>
 make_tuple (_Types&&... __values)
 {
-    typedef tuple<_TYPENAME _RW::__rw_make_tuple<_Types>::type...> _Tuple;
-    return _Tuple (std::forward<_Types> (__values)...);
+    typedef tuple<_TYPENAME _RW::__rw_make_tuple<_Types>::_C_type...> _Tuple;
+    return _Tuple (_RWSTD_FORWARD (_Types, __values)...);
 }
 
+
 template <class... _TypesT, class... _TypesU>
 tuple<_TypesT..., _TypesU...>
 tuple_cat (tuple<_TypesT...>&& __x,
@@ -112,18 +314,19 @@
 
 #    endif   // !defined _RWSTD_NO_RVALUE_REFERENCES
 
-template <class... _Types>
-tuple<_Types&...> tie (_Types&...);
-
 template <class... _TypesT, class... _TypesU>
 tuple<_TypesT..., _TypesU...>
 tuple_cat (const tuple<_TypesT...>& __x,
            const tuple<_TypesU...>& __y);
 
 
+template <class... _Types>
+tuple<_Types&...> tie (_Types&...);
+
+
 // 20.3.1.4, tuple helper classes:
 
-template <class Types>
+template <class _Types>
 class tuple_size;
 
 template <class... _Types>
@@ -135,7 +338,7 @@
 };
 
 
-template <int Index, class... Types>
+template <int _Index, class... _Types>
 struct tuple_element;
 
 template <class _Head, class... _Tail>
@@ -143,31 +346,24 @@
 {
     typedef _Head type;
 
+//internal:
 
-    typedef tuple<_Head, _Tail...>          _Tuple;
-
-#  define _RWSTD_ADD_CONST(T) \
-          _TYPENAME _RW::__rw_add_const<T>::type
-#  define _RWSTD_ADD_LVAL_REF(T) \
-          _TYPENAME _RW::__rw_add_lvalue_reference<T>::type
-
-    typedef _RWSTD_ADD_CONST (_Head)        _Const;
-    typedef _RWSTD_ADD_LVAL_REF (_Head)     _Ref;
-    typedef _RWSTD_ADD_LVAL_REF (_Const)    _ConstRef;
+    typedef _RW::__rw_tuple<_Head, _Tail...>    _Tuple;
 
-#  undef _RWSTD_ADD_CONST
-#  undef _RWSTD_ADD_LVAL_REF
+    typedef _TYPENAME _RWSTD_ADD_LVALUE_REFERENCE (_Head)       _Ref;
+    typedef _TYPENAME _RWSTD_ADD_CONST (_Head)                  _ConstHead;
+    typedef _TYPENAME _RWSTD_ADD_LVALUE_REFERENCE (_ConstHead)  _ConstRef;
 
     static _Ref
-    __get (_Tuple& __tuple) { return __tuple.__get (); }
+    _C_get (_Tuple& __tuple) { return __tuple._C_head (); }
 
     static _ConstRef
-    __get (const _Tuple& __tuple) { return __tuple.__get (); }
+    _C_get (const _Tuple& __tuple) { return __tuple._C_head (); }
 };
 
 template <int _Index, class _Head, class... _Tail>
 struct tuple_element<_Index, tuple<_Head, _Tail...> >
-    : tuple_element<_Index - 1, tuple<_Tail...> >
+    : public tuple_element<_Index - 1, tuple<_Tail...> >
 {
     // empty
 };
@@ -180,7 +376,7 @@
 get (tuple<_Head, _Tail...>& __tuple)
 {
     typedef tuple_element<_Index, tuple<_Head, _Tail...> > _Tuple;
-    return _Tuple::__get (__tuple);
+    return _Tuple::_C_get (__tuple);
 }
 
 template <int _Index, class _Head, class... _Tail>
@@ -188,7 +384,7 @@
 get (const tuple<_Head, _Tail...>& __tuple)
 {
     typedef tuple_element<_Index, tuple<_Head, _Tail...> > _Tuple;
-    return _Tuple::__get (__tuple);
+    return _Tuple::_C_get (__tuple);
 }
 
 
@@ -196,11 +392,33 @@
 
 template <class... _TypesT, class... _TypesU>
 bool operator== (const tuple<_TypesT...>& __x,
-                 const tuple<_TypesU...>& __y);
+                 const tuple<_TypesU...>& __y)
+{
+    return _RWSTD_STATIC_CAST (const _RW::__rw_tuple<_TypesT...>&, __x)
+           == _RWSTD_STATIC_CAST (const _RW::__rw_tuple<_TypesU...>&, __y);
+}
+
+_RWSTD_SPECIALIZED_FUNCTION
+bool operator== (const tuple<>& /*__x*/,
+                 const tuple<>& /*__y*/)
+{
+    return true;
+}
 
 template <class... _TypesT, class... _TypesU>
 bool operator< (const tuple<_TypesT...>& __x,
-                const tuple<_TypesU...>& __y);
+                const tuple<_TypesU...>& __y)
+{
+    return _RWSTD_STATIC_CAST (const _RW::__rw_tuple<_TypesT...>&, __x)
+           < _RWSTD_STATIC_CAST (const _RW::__rw_tuple<_TypesU...>&, __y);
+}
+
+_RWSTD_SPECIALIZED_FUNCTION
+bool operator< (const tuple<>& /*__x*/,
+                const tuple<>& /*__y*/)
+{
+    return false;
+}
 
 template <class... _TypesT, class... _TypesU>
 bool operator!= (const tuple<_TypesT...>& __x,
@@ -231,8 +449,9 @@
 }
 
 
-#  endif   // !defined _RWSTD_NO_VARIADIC_TEMPLATES
-
 }   // namespace std
 
+
+#  endif   // !defined _RWSTD_NO_VARIADIC_TEMPLATES
+
 #endif   // _RWSTD_TUPLE_INCLUDED

Modified: stdcxx/branches/4.3.x/tests/utilities/20.forward.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/utilities/20.forward.cpp?rev=672948&r1=672947&r2=672948&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.forward.cpp (original)
+++ stdcxx/branches/4.3.x/tests/utilities/20.forward.cpp Mon Jun 30 15:40:18 2008
@@ -81,7 +81,7 @@
 shared_ptr<Type> factory (AType&& at)
 {
     return shared_ptr<Type> (new Type (std::forward<AType> (at)));
-};
+}
 
 static void
 test_forward ()

Modified: stdcxx/branches/4.3.x/tests/utilities/20.tuple.cnstr.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/utilities/20.tuple.cnstr.cpp?rev=672948&r1=672947&r2=672948&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.tuple.cnstr.cpp (original)
+++ stdcxx/branches/4.3.x/tests/utilities/20.tuple.cnstr.cpp Mon Jun 30 15:40:18 2008
@@ -22,12 +22,11 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2008 Rogue Wave Software.
- * 
+ * Copyright 2008 Rogue Wave Software, Inc.
+ *
  **************************************************************************/
 
 #include <rw_driver.h>
-#include <rw/_defs.h>
 
 // compile out all test code if extensions disabled
 #ifndef _RWSTD_NO_EXT_CXX_0X
@@ -38,7 +37,6 @@
 
 /**************************************************************************/
 
-
 static void
 test_default_ctor ()
 {
@@ -70,9 +68,12 @@
     rw_info (0, __FILE__, __LINE__, "value copy constructor");
 
     const int i = 1;
-    const IntTuple it (i);
+    IntTuple it1 (i); _RWSTD_UNUSED (it1);
+    const IntTuple it2 (i); _RWSTD_UNUSED (it2);
+
     ConstIntTuple ct (i); _RWSTD_UNUSED (ct);
-    NestedTuple nt (it);
+
+    NestedTuple nt (it2); _RWSTD_UNUSED (nt);
 
     const long l = 1;
     const char* s = "string";
@@ -101,10 +102,10 @@
 {
     rw_info (0, __FILE__, __LINE__, "value move constructor");
 
-    IntTuple it (1); //_RWSTD_UNUSED (it);
+    const IntTuple it (1);
     ConstIntTuple ct (1); _RWSTD_UNUSED (ct);
     PairTuple pt (1L, "string"); _RWSTD_UNUSED (pt);
-    //NestedTuple nt (it); _RWSTD_UNUSED (nt);
+    NestedTuple nt (it); _RWSTD_UNUSED (nt);
 
     BigTuple bt (true, 'a', 1, 1.0, (void*)0, UserClass ());
     _RWSTD_UNUSED (bt);
@@ -137,7 +138,7 @@
     const ConstIntTuple ct1;
     ConstIntTuple ct2 (ct1); _RWSTD_UNUSED (ct2);
 
-    PairTuple pt1;
+    const PairTuple pt1;
     PairTuple pt2 (pt1); _RWSTD_UNUSED (pt2);
 
     const NestedTuple nt1;
@@ -248,7 +249,7 @@
              "copy constructor (heterogenous tuples)");
 
     const int i1 = 0; const char c = 'a'; const double d = 1.2;
-    void* const p = 0; UserClass uc;
+    void* const p = 0; const UserClass uc;
     BigTuple bt1 (i1, c, i1, d, p, uc); _RWSTD_UNUSED (bt1);
 
     const bool b = true; const int i2 = 'a';
@@ -356,8 +357,8 @@
 static int
 run_test (int, char*[])
 {
-    rw_warn (0, 0, __LINE__,
-             "test disabled because _RWSTD_NO_EXT_CXX_0X is defined");
+    rw_info (0, 0, __LINE__,
+             "tests for C++0x tuple extension disabled");
     return 0;
 }
 

Added: stdcxx/branches/4.3.x/tests/utilities/20.tuple.creation.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/utilities/20.tuple.creation.cpp?rev=672948&view=auto
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.tuple.creation.cpp (added)
+++ stdcxx/branches/4.3.x/tests/utilities/20.tuple.creation.cpp Mon Jun 30 15:40:18 2008
@@ -0,0 +1,126 @@
+/***************************************************************************
+ *
+ * 20.tuple.creation.cpp - tests exercising tuple creation functions
+ *
+ * $Id$
+ *
+ ***************************************************************************
+ *
+ * Licensed to the Apache Software  Foundation (ASF) under one or more
+ * contributor  license agreements.  See  the NOTICE  file distributed
+ * with  this  work  for  additional information  regarding  copyright
+ * ownership.   The ASF  licenses this  file to  you under  the Apache
+ * License, Version  2.0 (the  "License"); you may  not use  this file
+ * except in  compliance with the License.   You may obtain  a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the  License is distributed on an  "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY  KIND, either  express or
+ * implied.   See  the License  for  the  specific language  governing
+ * permissions and limitations under the License.
+ *
+ * Copyright 2008 Rogue Wave Software, Inc.
+ *
+ **************************************************************************/
+
+#include <rw_driver.h>
+
+ // compile out all test code if extensions disabled
+ #ifndef _RWSTD_NO_EXT_CXX_0X
+
+#include <functional>           // for reference_wrapper
+#include <tuple>
+
+#include "20.tuple.h"
+
+/**************************************************************************/
+
+typedef std::reference_wrapper<int>         IntRefWrap;
+
+static void
+test_make_tuple ()
+{
+    rw_info (0, __FILE__, __LINE__, "make_tuple");
+
+    IntTuple it1 = std::make_tuple (1);
+
+    typedef std::tuple<int, int>        IntTuple2;
+    int i = 2;
+    IntTuple2 it2 = std::make_tuple (1, i);
+
+    typedef std::tuple<int, int, int>   IntTuple3;
+    const int j = 3;
+    IntTuple3 it3 = std::make_tuple (1, i, j);
+
+}
+
+/**************************************************************************/
+
+static void
+test_tie ()
+{
+    rw_info (0, __FILE__, __LINE__, "tie");
+
+}
+
+/**************************************************************************/
+
+#define Big1stPart  bool, char, int, double
+#define Big2ndPart  void*, UserClass
+
+static void
+test_tuple_cat ()
+{
+    rw_info (0, __FILE__, __LINE__, "tuple_cat");
+
+#define Big1stPart  bool, char, int, double
+#define Big2ndPart  void*, UserClass
+
+    typedef std::tuple<Big1stPart> Big1stTuple;
+    Big1stTuple bt1 (true, 'a', 256, 3.14159);
+
+    typedef std::tuple<Big2ndPart> Big2ndTuple;
+    Big2ndTuple bt2 (&bt1, UserClass ());
+
+    //BigTuple bt (tuple_cat (bt1, bt2));
+}
+
+/**************************************************************************/
+
+static int
+run_test (int /*argc*/, char* /*argv*/ [])
+{
+    const void* p = _RWSTD_STATIC_CAST (const void*, &std::ignore);
+    _RWSTD_UNUSED (p);
+
+    test_make_tuple ();
+    test_tie ();
+    test_tuple_cat ();
+
+    return 0;
+}
+
+#else // !_RWSTD_NO_EXT_CXX_0X
+
+static int
+run_test (int, char*[])
+{
+    rw_info (0, 0, __LINE__,
+             "tests for C++0x tuple extension disabled");
+    return 0;
+}
+
+#endif // !_RWSTD_NO_EXT_CXX_0X
+
+/*extern*/ int
+main (int argc, char* argv [])
+{
+    return rw_test (argc, argv, __FILE__,
+                    "[tuple.creation]",
+                    "20.3.1.3  Tuple creation functions",
+                    run_test, "", 0);
+}
+

Propchange: stdcxx/branches/4.3.x/tests/utilities/20.tuple.creation.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: stdcxx/branches/4.3.x/tests/utilities/20.tuple.creation.cpp
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: stdcxx/branches/4.3.x/tests/utilities/20.tuple.elem.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/utilities/20.tuple.elem.cpp?rev=672948&r1=672947&r2=672948&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.tuple.elem.cpp (original)
+++ stdcxx/branches/4.3.x/tests/utilities/20.tuple.elem.cpp Mon Jun 30 15:40:18 2008
@@ -22,12 +22,11 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2008 Rogue Wave Software.
- * 
+ * Copyright 2008 Rogue Wave Software, Inc.
+ *
  **************************************************************************/
 
 #include <rw_driver.h>
-#include <rw/_defs.h>
 
 // compile out all test code if extensions disabled
 #ifndef _RWSTD_NO_EXT_CXX_0X
@@ -40,45 +39,113 @@
 
 #include <rw_valcmp.h>
 
+#define BOOL_VAL    true
+#define CHAR_VAL    'a'
+#define INT_VAL     256
+#define DBL_VAL     3.14159
+#define PTR_VAL     ptr_val
+#define USER_VAL    user_val
+
+static void*        ptr_val;
+static UserClass    user_val;
+
 static void
-test_get ()
+test_const_get (const BigTuple& bt)
 {
-    rw_info (0, __FILE__, __LINE__, "get");
+    rw_info (0, __FILE__, __LINE__, "get (const)");
 
-    IntTuple it (4);
-    rw_assert (std::get<0> (it) == 4, __FILE__, __LINE__,
-               "get<0> (it), got %d, expected 4", std::get<0> (it));
-
-    BigTuple bt (true, 'a', 256, 3.14159, &it, UserClass ());
-    rw_assert (std::get<0> (bt) == true, __FILE__, __LINE__,
-               "get<0>(bt), got %d, expected true", std::get<0> (bt));
-    rw_assert (std::get<1> (bt) == 'a', __FILE__, __LINE__,
-               "get<1>(bt), got %c, expected 'a'", std::get<1> (bt));
-    rw_assert (std::get<2> (bt) == 256, __FILE__, __LINE__,
-               "get<2>(bt), got %d, expected 256", std::get<2> (bt));
-    rw_assert (0 == rw_dblcmp (std::get<3> (bt), 3.14159),
-               __FILE__, __LINE__,
-               "get<3>(bt), got %f, expected 3.14", std::get<3> (bt));
-    rw_assert (std::get<4> (bt) == &it, __FILE__, __LINE__,
-               "get<4>(bt), got %p, expected %p", std::get<4> (bt), &it);
+    const bool& b = std::get<0> (bt);
+    rw_assert (b == BOOL_VAL, __FILE__, __LINE__, "get<0>(bt), got %s, "
+               "expected %s", b? "true": "false", BOOL_VAL? "true": "false");
+
+    const char& c = std::get<1> (bt);
+    rw_assert (c == CHAR_VAL, __FILE__, __LINE__,
+               "get<1>(bt), got \'%c\', expected \'%c\'", c, CHAR_VAL);
+
+    const int& i = std::get<2> (bt);
+    rw_assert (i == INT_VAL, __FILE__, __LINE__,
+               "get<2>(bt), got %d, expected %d", i, INT_VAL);
+
+    const double& d = std::get<3> (bt);
+    rw_assert (0 == rw_dblcmp (d, DBL_VAL), __FILE__, __LINE__,
+               "get<3>(bt), got %f, expected %f", d, DBL_VAL);
+
+    void* const& p = std::get<4> (bt);
+    rw_assert (p == PTR_VAL, __FILE__, __LINE__,
+               "get<4>(bt), got %p, expected %p", p, PTR_VAL);
+
+    const UserClass& uc = std::get<5> (bt);
+    rw_assert (uc == USER_VAL, __FILE__, __LINE__,
+               "get<5>(bt), got %d, expected %d",
+               uc.data_.val_, USER_VAL.data_.val_);
 }
 
 /**************************************************************************/
 
 static void
-test_const_get ()
+test_get (BigTuple& bt)
 {
-    rw_info (0, __FILE__, __LINE__, "get (const)");
+    rw_info (0, __FILE__, __LINE__, "get");
 
+    bool& b = std::get<0> (bt);
+    rw_assert (b == BOOL_VAL, __FILE__, __LINE__,
+               "get<0>(bt), got %d, expected %b", b, BOOL_VAL);
+    b = !BOOL_VAL;
+    rw_assert (std::get<0> (bt) == !BOOL_VAL, __FILE__, __LINE__,
+               "get<0>(bt), got %d, expected %b", std::get<0> (bt),
+               !BOOL_VAL);
+
+    char& c = std::get<1> (bt);
+    rw_assert (c == 'a', __FILE__, __LINE__,
+               "get<1>(bt), got %c, expected \'%c\'", c, CHAR_VAL);
+    c = '1';
+    rw_assert (std::get<1> (bt) == '1', __FILE__, __LINE__,
+               "get<1>(bt), got %c, expected \'1\'", std::get<1> (bt));
+
+    int& i = std::get<2> (bt);
+    rw_assert (i == INT_VAL, __FILE__, __LINE__,
+               "get<2>(bt), got %d, expected %d", i, INT_VAL);
+    i = INT_VAL+1;
+    rw_assert (std::get<2> (bt) == INT_VAL+1, __FILE__, __LINE__,
+               "get<1>(bt), got %d, expected %d", std::get<2> (bt),
+               INT_VAL+1);
+
+    double& d = std::get<3> (bt);
+    rw_assert (0 == rw_dblcmp (d, DBL_VAL), __FILE__, __LINE__,
+               "get<3>(bt), got %f, expected %f", d, DBL_VAL);
+    d = DBL_VAL*DBL_VAL;
+    rw_assert (0 == rw_dblcmp (std::get<3> (bt), DBL_VAL*DBL_VAL),
+               __FILE__, __LINE__,
+               "get<3>(bt), got %f, expected %f", std::get<3> (bt),
+               DBL_VAL*DBL_VAL);
+
+    void* p = std::get<4> (bt);
+    rw_assert (p == PTR_VAL, __FILE__, __LINE__,
+               "get<4>(bt), got %p, expected %p", p, PTR_VAL);
+    p = &d;
+    rw_assert (std::get<4> (bt) == &d, __FILE__, __LINE__,
+               "get<4>(bt), got %p, expected %p", std::get<4> (bt), &d);
+
+    UserClass& uc = std::get<5> (bt);
+    rw_assert (uc == USER_VAL, __FILE__, __LINE__,
+               "get<5>(bt), got %d, expected %d",
+               uc.data_.val_, USER_VAL.data_.val_);
+    uc.data_.val_ = INT_VAL;
+    rw_assert ((std::get<5> (bt)).data_.val_ == INT_VAL, __FILE__, __LINE__,
+               "get<5>(bt), got %d, expected %d",
+               (std::get<5> (bt)).data_.val_, INT_VAL);
 }
 
 /**************************************************************************/
 
 static int
-run_test (int /*unused*/, char* /*unused*/ [])
+run_test (int /*argc*/, char* argv [])
 {
-    test_get ();
-    test_const_get ();
+    ptr_val = static_cast<void*> (argv [0]);
+    BigTuple bt (BOOL_VAL, CHAR_VAL, INT_VAL, DBL_VAL, PTR_VAL, USER_VAL);
+
+    test_const_get (bt);
+    test_get (bt);
 
     return 0;
 }
@@ -88,8 +155,8 @@
 static int
 run_test (int, char*[])
 {
-    rw_warn (0, 0, __LINE__,
-             "test disabled because _RWSTD_NO_EXT_CXX_0X is defined");
+    rw_info (0, 0, __LINE__,
+             "tests for C++0x tuple extension disabled");
     return 0;
 }
 
@@ -99,8 +166,7 @@
 main (int argc, char* argv [])
 {
     return rw_test (argc, argv, __FILE__,
-                    "[tuple.elem]",
-                    "20.3.1.5  Element access",
+                    "[tuple.elem]", "20.3.1.5  Element access",
                     run_test, "", 0);
 }
 

Modified: stdcxx/branches/4.3.x/tests/utilities/20.tuple.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/utilities/20.tuple.h?rev=672948&r1=672947&r2=672948&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.tuple.h (original)
+++ stdcxx/branches/4.3.x/tests/utilities/20.tuple.h Mon Jun 30 15:40:18 2008
@@ -22,8 +22,8 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2008 Rogue Wave Software.
- * 
+ * Copyright 2008 Rogue Wave Software, Inc.
+ *
  **************************************************************************/
 
 #ifndef RW_20_TUPLE_H_INCLUDED

Modified: stdcxx/branches/4.3.x/tests/utilities/20.tuple.helpers.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/utilities/20.tuple.helpers.cpp?rev=672948&r1=672947&r2=672948&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.tuple.helpers.cpp (original)
+++ stdcxx/branches/4.3.x/tests/utilities/20.tuple.helpers.cpp Mon Jun 30 15:40:18 2008
@@ -22,12 +22,11 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2008 Rogue Wave Software.
- * 
+ * Copyright 2008 Rogue Wave Software, Inc.
+ *
  **************************************************************************/
 
 #include <rw_driver.h>
-#include <rw/_defs.h>
 
 // compile out all test code if extensions disabled
 #ifndef _RWSTD_NO_EXT_CXX_0X
@@ -38,7 +37,6 @@
 
 /**************************************************************************/
 
-
 static void
 test_tuple_size ()
 {
@@ -151,8 +149,8 @@
 static int
 run_test (int, char*[])
 {
-    rw_warn (0, 0, __LINE__,
-             "test disabled because _RWSTD_NO_EXT_CXX_0X is defined");
+    rw_info (0, 0, __LINE__,
+             "tests for C++0x tuple extension disabled");
     return 0;
 }
 

Added: stdcxx/branches/4.3.x/tests/utilities/20.tuple.rel.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/utilities/20.tuple.rel.cpp?rev=672948&view=auto
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.tuple.rel.cpp (added)
+++ stdcxx/branches/4.3.x/tests/utilities/20.tuple.rel.cpp Mon Jun 30 15:40:18 2008
@@ -0,0 +1,137 @@
+/***************************************************************************
+ *
+ * 20.tuple.rel.cpp - tests exercising tuple relational operators
+ *
+ * $Id$
+ *
+ ***************************************************************************
+ *
+ * Licensed to the Apache Software  Foundation (ASF) under one or more
+ * contributor  license agreements.  See  the NOTICE  file distributed
+ * with  this  work  for  additional information  regarding  copyright
+ * ownership.   The ASF  licenses this  file to  you under  the Apache
+ * License, Version  2.0 (the  "License"); you may  not use  this file
+ * except in  compliance with the License.   You may obtain  a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the  License is distributed on an  "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY  KIND, either  express or
+ * implied.   See  the License  for  the  specific language  governing
+ * permissions and limitations under the License.
+ *
+ * Copyright 2008 Rogue Wave Software, Inc.
+ *
+ **************************************************************************/
+
+#include <rw_driver.h>
+
+// compile out all test code if extensions disabled
+#ifndef _RWSTD_NO_EXT_CXX_0X
+
+#include <tuple>
+
+#include "20.tuple.h"
+
+/**************************************************************************/
+
+static void
+test_eq ()
+{
+    rw_info (0, __FILE__, __LINE__, "operator==");
+
+    EmptyTuple nt1, nt2;
+    rw_assert (nt1 == nt1, __FILE__, __LINE__,
+               "nt1 == nt1, got false, expected true");
+    rw_assert (nt1 == nt2, __FILE__, __LINE__,
+               "nt1 == nt2, got true, expected false");
+
+    IntTuple it1 (1), it2 (1);
+    rw_assert (it1 == it1, __FILE__, __LINE__,
+               "it1 == it1, got false, expected true");
+    rw_assert (it1 == it2, __FILE__, __LINE__,
+               "it1 == it2, got false, expected true");
+
+    UserClass uc;
+    UserTuple ut1 (uc), ut2 (uc);
+    rw_assert (ut1 == ut1, __FILE__, __LINE__,
+               "ut1 == ut1, got false, expected true");
+    rw_assert (ut1 == ut2, __FILE__, __LINE__,
+               "ut1 == ut2, got false, expected true");
+
+    BigTuple bt1 (true, 'a', 256, 3.14159, &nt1, uc);
+    BigTuple bt2 (true, 'a', 256, 3.14159, &nt1, uc);
+    rw_assert (bt1 == bt1, __FILE__, __LINE__,
+               "bt1 == bt1, got false, expected true");
+    rw_assert (bt1 == bt2, __FILE__, __LINE__,
+               "bt1 == bt2, got false, expected true");
+}
+
+/**************************************************************************/
+
+static void
+test_lt ()
+{
+    rw_info (0, __FILE__, __LINE__, "operator<");
+
+    EmptyTuple nt1, nt2;
+    rw_assert (!(nt1 < nt1), __FILE__, __LINE__,
+               "nt1 < nt1, got true, expected false");
+    rw_assert (!(nt1 < nt2), __FILE__, __LINE__,
+               "nt1 < nt2, got true, expected false");
+
+    IntTuple it1 (1), it2 (2);
+    rw_assert (it1 < it2, __FILE__, __LINE__,
+               "it1 < it2, got false, expected true");
+
+    UserClass uc1, uc2;
+    uc1.data_.val_ = 1, uc2.data_.val_ = 2;
+
+    UserTuple ut1 (uc1), ut2 (uc2);
+    rw_assert (ut1 < ut2, __FILE__, __LINE__,
+               "ut1 < ut2, got false, expected true");
+
+    BigTuple bt1 (true, 'a', 255, 3.14159, &nt1, uc1);
+    BigTuple bt2 (true, 'a', 256, 3.14159, &nt1, uc1);
+    rw_assert (bt1 < bt2, __FILE__, __LINE__,
+               "bt1 < bt2, got false, expected true");
+}
+
+/**************************************************************************/
+
+static int
+run_test (int /*argc*/, char* /*argv*/ [])
+{
+    test_eq ();
+    test_lt ();
+
+    //test_ne ();
+    //test_gt ();
+    //test_le ();
+    //test_ge ();
+
+    return 0;
+}
+
+#else // !_RWSTD_NO_EXT_CXX_0X
+
+static int
+run_test (int, char*[])
+{
+    rw_info (0, 0, __LINE__,
+             "tests for C++0x tuple extension disabled");
+    return 0;
+}
+
+#endif // !_RWSTD_NO_EXT_CXX_0X
+
+/*extern*/ int
+main (int argc, char* argv [])
+{
+    return rw_test (argc, argv, __FILE__,
+                    "[tuple.rel]", "20.3.1.6  Relational operators",
+                    run_test, "", 0);
+}
+

Propchange: stdcxx/branches/4.3.x/tests/utilities/20.tuple.rel.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: stdcxx/branches/4.3.x/tests/utilities/20.tuple.rel.cpp
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message