Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59607 - sandbox/statistics/detail/assign/boost/assign/detail
From: erwann.rogard_at_[hidden]
Date: 2010-02-09 18:48:58


Author: e_r
Date: 2010-02-09 18:48:57 EST (Tue, 09 Feb 2010)
New Revision: 59607
URL: http://svn.boost.org/trac/boost/changeset/59607

Log:
add assign_value
Added:
   sandbox/statistics/detail/assign/boost/assign/detail/
   sandbox/statistics/detail/assign/boost/assign/detail/assign_value.hpp (contents, props changed)

Added: sandbox/statistics/detail/assign/boost/assign/detail/assign_value.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/assign/boost/assign/detail/assign_value.hpp 2010-02-09 18:48:57 EST (Tue, 09 Feb 2010)
@@ -0,0 +1,63 @@
+//////////////////////////////////////////////////////////////////////////////
+// assign::detail::assign_value.hpp //
+// //
+// (C) Copyright 2010 M.P.G //
+// 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_VALUE_MPG_2010_HPP
+#define BOOST_ASSIGN_DETAIL_ASSIGN_VALUE_MPG_2010_HPP
+
+namespace boost{
+namespace assign_detail{
+
+ // This is a reference wrapper whose assignment operator copies the value of
+ // the rhs to the object pointed to.
+ //
+ // This is in contrast to assign_reference whose operator= rebinds the
+ // address of the internal pointer. To that effect, call instead rebind()
+ template< class T >
+ struct assign_value
+ {
+ assign_value()
+ { /* intentionally empty */ }
+
+ assign_value( T& r ) : ref_(&r)
+ { }
+
+ void operator=( const T& r )
+ {
+ *ref_ = r;
+ }
+
+ operator T&() const
+ {
+ return *ref_;
+ }
+
+ void swap( assign_value& r )
+ {
+ std::swap( *ref_, *r.ref_ );
+ }
+
+ T& get_ref() const
+ {
+ return *ref_;
+ }
+
+ void rebind( T & r )
+ {
+ ref_ = &r;
+ }
+
+ private:
+ T* ref_;
+
+ };
+
+}// assign_detail
+}// 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