Author: elemings
Date: Fri Jun 27 14:10:30 2008
New Revision: 672395

URL: http://svn.apache.org/viewvc?rev=672395&view=rev
Log:
2008-06-27  Eric Lemings <[EMAIL PROTECTED]>

        STDCXX-958
        * include/rw/_ref_wrap.h: Convert internal namespace members to
        standard namespace members (at least until such a time when
        internal namespace members are actually needed).
        (reference_wrapper): Implemented basic constructors, operators,
        and accessors.  (No specializations, function inheritance,
        result_of, or invocation operators yet.)
        (ref, cref): Also implemented.
        * include/functional: Include <rw/_ref_wrap.h> header.
        (Internal header contains C++0x guards so it only gets compiled
        for C++0X code.)


Modified:
    stdcxx/branches/4.3.x/include/functional
    stdcxx/branches/4.3.x/include/rw/_ref_wrap.h

Modified: stdcxx/branches/4.3.x/include/functional
URL: 
http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/functional?rev=672395&r1=672394&r2=672395&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/functional (original)
+++ stdcxx/branches/4.3.x/include/functional Fri Jun 27 14:10:30 2008
@@ -37,7 +37,7 @@
  * permissions and limitations under the License.
  *
  * Copyright 1994-2006 Rogue Wave Software.
- * 
+ *
  **************************************************************************/
 
 #ifndef _RWSTD_FUNCTIONAL_INCLUDED
@@ -45,10 +45,11 @@
 
 
 #include <rw/_funcbase.h>
+#include <rw/_ref_wrap.h>
 #include <rw/_defs.h>
 
 
-_RWSTD_NAMESPACE (std) { 
+_RWSTD_NAMESPACE (std) {
 
 
 // 20.3.2 - Arithmetic operations
@@ -663,7 +664,7 @@
 }   // namespace std
 
 
-_RWSTD_NAMESPACE (__rw) { 
+_RWSTD_NAMESPACE (__rw) {
 
 
 // extension: returns the argument

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=672395&r1=672394&r2=672395&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_ref_wrap.h (original)
+++ stdcxx/branches/4.3.x/include/rw/_ref_wrap.h Fri Jun 27 14:10:30 2008
@@ -24,8 +24,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_RW_REF_WRAP_INCLUDED
@@ -36,17 +36,66 @@
 #  if !defined _RWSTD_NO_EXT_CXX_0X
 
 
-_RWSTD_NAMESPACE (__rw) {
+_RWSTD_NAMESPACE (std) {
 
 
 template <class _Type>
-class __rw_ref_wrap
+class reference_wrapper
 {
+    _Type* _C_ptr;
+
+public:
+
+    typedef _Type type;
+
+    reference_wrapper (_Type& __x)
+        : _C_ptr (&__x) { /* empty */ }
+
+    reference_wrapper (const reference_wrapper<_Type>& __x)
+        : _C_ptr (__x._C_ptr) { /* empty */ }
+
+    reference_wrapper& operator= (const reference_wrapper<_Type>& __x) {
+        _C_ptr = __x._C_ptr;
+        return *this;
+    }
 
+    operator _Type& () const { return *_C_ptr; }
+
+    _Type& get() const { return *_C_ptr; }
 };
 
 
-}   // namespace __rw
+template <class _Type>
+inline reference_wrapper<_Type>
+ref (_Type& __x)
+{
+    return reference_wrapper<_Type> (__x);
+}
+
+template <class _Type>
+inline reference_wrapper<_Type>
+ref (reference_wrapper<_Type>& __x)
+{
+    return reference_wrapper<_Type> (__x);
+}
+
+
+template <class _Type>
+inline reference_wrapper<const _Type>
+cref (const _Type& __x)
+{
+    return reference_wrapper<const _Type> (__x);
+}
+
+template <class _Type>
+inline reference_wrapper<const _Type>
+cref (reference_wrapper<const _Type>& __x)
+{
+    return reference_wrapper<const _Type> (__x);
+}
+
+
+}   // namespace std
 
 
 #  endif   // !defined _RWSTD_NO_EXT_CXX_0X


Reply via email to