Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60363 - sandbox/statistics/detail/assign/boost/assign/auto_size/detail
From: erwann.rogard_at_[hidden]
Date: 2010-03-08 13:01:58


Author: e_r
Date: 2010-03-08 13:01:58 EST (Mon, 08 Mar 2010)
New Revision: 60363
URL: http://svn.boost.org/trac/boost/changeset/60363

Log:
m
Added:
   sandbox/statistics/detail/assign/boost/assign/auto_size/detail/assign_reference_rebind.hpp (contents, props changed)

Added: sandbox/statistics/detail/assign/boost/assign/auto_size/detail/assign_reference_rebind.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/detail/assign_reference_rebind.hpp 2010-03-08 13:01:58 EST (Mon, 08 Mar 2010)
@@ -0,0 +1,79 @@
+//////////////////////////////////////////////////////////////////////////////
+// assign::detail::assign_reference_rebind.hpp //
+// //
+// (C) Copyright Thorsten Ottosen 2003-2004. Use, modification and //
+// (C) Copyright 2010 Erwann Rogard //
+// Use, modification and distribution are subject to the //
+// Boost Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+//////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_ASSIGN_DETAIL_ASSIGN_REFERENCE_REBIND_ER_2010_HPP
+#define BOOST_ASSIGN_DETAIL_ASSIGN_REFERENCE_REBNID_ER_2010_HPP
+
+namespace boost{
+namespace assign{
+namespace detail{
+
+ // same as assign_detail::assign_reference except swaps by address
+ template< class T >
+ struct assign_reference_rebind
+ {
+ assign_reference_rebind()
+ { /* intentionally empty */ }
+
+ assign_reference_rebind( T& r ) : ref_(&r)
+ { }
+
+ void operator=( T& r )
+ {
+ ref_ = &r;
+ }
+
+ operator T&() const
+ {
+ return *ref_;
+ }
+
+ void swap( assign_reference_rebind& r )
+ {
+ T* tmp = this->ref_;
+ ref_ = r.ref_;
+ r.ref_ = tmp;
+ }
+
+ T& get_ref() const
+ {
+ return *ref_;
+ }
+
+ private:
+ T* ref_;
+
+ };
+
+ template< class T >
+ inline bool operator<( const assign_reference_rebind<T>& l,
+ const assign_reference_rebind<T>& r )
+ {
+ return l.get_ref() < r.get_ref();
+ }
+
+ template< class T >
+ inline bool operator>( const assign_reference_rebind<T>& l,
+ const assign_reference_rebind<T>& r )
+ {
+ return l.get_ref() > r.get_ref();
+ }
+
+ template< class T >
+ inline void swap( assign_reference_rebind<T>& l,
+ assign_reference_rebind<T>& r )
+ {
+ l.swap( r );
+ }
+
+}// detail
+}// assign
+}// boost
+
+#endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk