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/06/23 21:36:28 UTC

svn commit: r670715 - in /stdcxx/branches/4.3.x: include/rw/_tuple.h tests/utilities/20.tuple.elem.cpp

Author: elemings
Date: Mon Jun 23 12:36:27 2008
New Revision: 670715

URL: http://svn.apache.org/viewvc?rev=670715&view=rev
Log:
2008-06-23  Eric Lemings <er...@roguewave.com>

	STDCXX-958
	* include/rw/_tuple.h: Allow recursive tuple to access base
	class.
	* tests/utilities/20.tuple.elem.cpp (test_get): Added more get()
	tests for a BigTuple.


Modified:
    stdcxx/branches/4.3.x/include/rw/_tuple.h
    stdcxx/branches/4.3.x/tests/utilities/20.tuple.elem.cpp

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=670715&r1=670714&r2=670715&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_tuple.h (original)
+++ stdcxx/branches/4.3.x/include/rw/_tuple.h Mon Jun 23 12:36:27 2008
@@ -90,7 +90,7 @@
  */
 template < class _HeadT, class... _TailT >
 class tuple< _HeadT, _TailT... >
-    : tuple< _TailT... >
+    : public tuple< _TailT... >
 {
     typedef tuple< _TailT... >  _Base;
 
@@ -346,6 +346,11 @@
     tuple (allocator_arg_t, const _Alloc& __alloc,
            const pair<_TypeU1, _TypeU2>& __pair);
 
+public: // internal
+
+    _TypeT1&        __get ()       { return _C_first; }
+    const _TypeT1&  __get () const { return _C_first; }
+
 };
 
 

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=670715&r1=670714&r2=670715&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 23 12:36:27 2008
@@ -33,6 +33,7 @@
 /**************************************************************************/
 
 #include <rw_driver.h>
+#include <rw_valcmp.h>
 
 static void
 test_get ()
@@ -42,6 +43,19 @@
     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);
 }
 
 /**************************************************************************/