Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62969 - trunk/boost/multi_array
From: garcia_at_[hidden]
Date: 2010-06-15 08:04:51


Author: garcia
Date: 2010-06-15 08:04:50 EDT (Tue, 15 Jun 2010)
New Revision: 62969
URL: http://svn.boost.org/trac/boost/changeset/62969

Log:
Copied Jeremiah's fix (using Boost.Iterator's arrow proxy) back to the trunk.

Text files modified:
   trunk/boost/multi_array/iterator.hpp | 19 +++++++++++++++++++
   1 files changed, 19 insertions(+), 0 deletions(-)

Modified: trunk/boost/multi_array/iterator.hpp
==============================================================================
--- trunk/boost/multi_array/iterator.hpp (original)
+++ trunk/boost/multi_array/iterator.hpp 2010-06-15 08:04:50 EDT (Tue, 15 Jun 2010)
@@ -33,6 +33,17 @@
 // iterator components
 /////////////////////////////////////////////////////////////////////////
 
+template <class T>
+struct operator_arrow_proxy
+{
+ operator_arrow_proxy(T const& px) : value_(px) {}
+ T* operator->() const { return &value_; }
+ // This function is needed for MWCW and BCC, which won't call operator->
+ // again automatically per 13.3.1.2 para 8
+ operator T*() const { return &value_; }
+ mutable T value_;
+};
+
 template <typename T, typename TPtr, typename NumDims, typename Reference>
 class array_iterator;
 
@@ -103,6 +114,14 @@
     strides_(rhs.strides_), index_base_(rhs.index_base_) { }
 
 
+ // RG - we make our own operator->
+ operator_arrow_proxy<reference>
+ operator->() const
+ {
+ return operator_arrow_proxy<reference>(this->dereference());
+ }
+
+
   reference dereference() const
   {
     typedef typename value_accessor_generator<T,NumDims>::type accessor;


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