stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elemi...@apache.org
Subject svn commit: r673227 - in /stdcxx/branches/4.3.x: include/rw/_forward.h include/rw/_tuple.h include/tuple tests/utilities/20.tuple.cnstr.cpp tests/utilities/20.tuple.creation.cpp tests/utilities/20.tuple.h
Date Tue, 01 Jul 2008 23:19:48 GMT
Author: elemings
Date: Tue Jul  1 16:19:48 2008
New Revision: 673227

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

	STDCXX-958
	* include/tuple: Uncomment ctors that were temporarily commented
	out (and accidently checked in) due to forward/move semantics
	problem in make_tuple() with reference wrappers.
	* include/rw/_forward.h: Remove unnecessary _EXPORT macro.
	Define functions as inline.  Change `std' namespace to `_STD' in
	definition of _RWSTD_MOVE function macro.
	* include/rw/_tuple.h: Fix forward/move semantics for homogenous
	move ctor.
	* tests/utilities/20.tuple.h: Add tuple with reference type.
	* tests/utilities/20.tuple.cnstr.cpp: Added tests for tuples
	with reference types.  Added more tests for value move ctors.
	* tests/utilities/20.tuple.creation.cpp: Added two small tests
	for make_tuple() with reference wrappers.


Modified:
    stdcxx/branches/4.3.x/include/rw/_forward.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.tuple.cnstr.cpp
    stdcxx/branches/4.3.x/tests/utilities/20.tuple.creation.cpp
    stdcxx/branches/4.3.x/tests/utilities/20.tuple.h

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=673227&r1=673226&r2=673227&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_forward.h (original)
+++ stdcxx/branches/4.3.x/include/rw/_forward.h Tue Jul  1 16:19:48 2008
@@ -45,7 +45,6 @@
 
 // 20.2.2, forward/move helpers:
 
-_EXPORT
 template <class _Type>
 struct identity
 {
@@ -61,25 +60,23 @@
 
 #    if !defined _RWSTD_NO_RVALUE_REFERENCES
 
-_EXPORT
 template <class _Type>
-_Type&&
+inline _Type&&
 forward (_TYPENAME identity<_Type>::type&& __x)
 {
     return __x;
 }
 
 
-_EXPORT
 template <class _Type>
-_TYPENAME _RWSTD_REMOVE_REFERENCE(_Type)&&
+inline _TYPENAME _RWSTD_REMOVE_REFERENCE(_Type)&&
 move (_Type&& __x)
 {
     return __x;
 }
 
 #      define _RWSTD_FORWARD(_Type, __x)    _STD::forward<_Type> (__x)
-#      define _RWSTD_MOVE(__x)              std::move (__x)
+#      define _RWSTD_MOVE(__x)              _STD::move (__x)
 
 #    else   // no rvalue references
 

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=673227&r1=673226&r2=673227&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_tuple.h (original)
+++ stdcxx/branches/4.3.x/include/rw/_tuple.h Tue Jul  1 16:19:48 2008
@@ -100,8 +100,8 @@
 #      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 */ }
+        : _Base (std::move<_Base&&> (__tuple._C_tail ()))
+        , _C_data (_RWSTD_FORWARD (_HeadT, __tuple._C_data)) { /* empty */ }
 
     __rw_tuple& operator= (__rw_tuple&& __tuple) {
         _Base::operator= (_RWSTD_FORWARD (_Base, __tuple._C_tail ()));

Modified: stdcxx/branches/4.3.x/include/tuple
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/tuple?rev=673227&r1=673226&r2=673227&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/tuple (original)
+++ stdcxx/branches/4.3.x/include/tuple Tue Jul  1 16:19:48 2008
@@ -97,8 +97,8 @@
 
 #    if !defined _RWSTD_NO_RVALUE_REFERENCES
 
-    //tuple (tuple&& __tuple)
-        //: _Base (_RWSTD_FORWARD (_Base, __tuple)) { /* empty */ }
+    tuple (tuple&& __tuple)
+        : _Base (_RWSTD_FORWARD (_Base, __tuple)) { /* empty */ }
 
     tuple& operator= (tuple&& __tuple) {
         _Base::operator= (_RWSTD_FORWARD (_Base, __tuple));
@@ -109,9 +109,9 @@
     _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 (tuple<_TypesU...>&& __tuple)
+        : _Base (_RWSTD_FORWARD (_BaseU, __tuple)) { /* empty */ }
 
     template <class... _TypesU>
     tuple& operator= (tuple<_TypesU...>&& __tuple) {

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=673227&r1=673226&r2=673227&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 Tue Jul  1 16:19:48 2008
@@ -45,6 +45,7 @@
     EmptyTuple et; _RWSTD_UNUSED (et);
     IntTuple it; _RWSTD_UNUSED (it);
     ConstIntTuple ct; _RWSTD_UNUSED (ct);
+    //IntRefTuple rt; _RWSTD_UNUSED (rt); // ill-formed for references
     PairTuple pt; _RWSTD_UNUSED (pt);
     NestedTuple nt; _RWSTD_UNUSED (nt);
     BigTuple bt; _RWSTD_UNUSED (bt);
@@ -67,11 +68,11 @@
 {
     rw_info (0, __FILE__, __LINE__, "value copy constructor");
 
-    const int i = 1;
+    int i = 1;
     IntTuple it1 (i); _RWSTD_UNUSED (it1);
     const IntTuple it2 (i); _RWSTD_UNUSED (it2);
-
     ConstIntTuple ct (i); _RWSTD_UNUSED (ct);
+    IntRefTuple rt (i); _RWSTD_UNUSED (rt);
 
     NestedTuple nt (it2); _RWSTD_UNUSED (nt);
 
@@ -102,10 +103,20 @@
 {
     rw_info (0, __FILE__, __LINE__, "value move constructor");
 
-    const IntTuple it (1);
-    ConstIntTuple ct (1); _RWSTD_UNUSED (ct);
+    IntTuple it1 (1); _RWSTD_UNUSED (it1);
+    IntTuple it2 (int ()); _RWSTD_UNUSED (it2);
+
+    const IntTuple it3 (1); _RWSTD_UNUSED (it3);
+    const IntTuple it4 (const IntTuple ()); _RWSTD_UNUSED (it4);
+
+    ConstIntTuple ct1 (1); _RWSTD_UNUSED (ct1);
+    ConstIntTuple ct2 (ConstIntTuple ()); _RWSTD_UNUSED (ct2);
+
+    IntRefTuple rt2 (int ()); _RWSTD_UNUSED (rt2);
+
+    NestedTuple nt (ct1); _RWSTD_UNUSED (nt);
+
     PairTuple pt (1L, "string"); _RWSTD_UNUSED (pt);
-    NestedTuple nt (it); _RWSTD_UNUSED (nt);
 
     BigTuple bt (true, 'a', 1, 1.0, (void*)0, UserClass ());
     _RWSTD_UNUSED (bt);
@@ -138,6 +149,9 @@
     const ConstIntTuple ct1;
     ConstIntTuple ct2 (ct1); _RWSTD_UNUSED (ct2);
 
+    int i; const IntRefTuple rt1 (i);
+    IntRefTuple rt2 (rt1); _RWSTD_UNUSED (rt2);
+
     const PairTuple pt1;
     PairTuple pt2 (pt1); _RWSTD_UNUSED (pt2);
 

Modified: 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=673227&r1=673226&r2=673227&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.tuple.creation.cpp (original)
+++ stdcxx/branches/4.3.x/tests/utilities/20.tuple.creation.cpp Tue Jul  1 16:19:48 2008
@@ -55,6 +55,9 @@
     const int j = 3;
     IntTuple3 it3 = std::make_tuple (1, i, j);
 
+    IntRefTuple rt1 = std::make_tuple (std::ref (i));
+
+    std::tuple<const int&> rt2 = std::make_tuple (std::cref (i));
 }
 
 /**************************************************************************/

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=673227&r1=673226&r2=673227&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.tuple.h (original)
+++ stdcxx/branches/4.3.x/tests/utilities/20.tuple.h Tue Jul  1 16:19:48 2008
@@ -37,11 +37,16 @@
 // various tuple types for test purposes
 
 typedef std::tuple < >                      EmptyTuple;
+
 typedef std::tuple < int >                  IntTuple;
 typedef std::tuple < const int >            ConstIntTuple;
+typedef std::tuple < int& >                 IntRefTuple;
+
+typedef std::tuple < std::tuple < int > >   NestedTuple;
+
 typedef std::tuple < long, const char* >    PairTuple;
+
 typedef std::tuple < UserClass >            UserTuple;
-typedef std::tuple < std::tuple < int > >   NestedTuple;
 
 #define BigList      bool, char, int, double, void*, UserClass
 #define BigListSize  6



Mime
View raw message