Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76571 - trunk/boost/multi_array
From: garcia_at_[hidden]
Date: 2012-01-17 21:27:55


Author: garcia
Date: 2012-01-17 21:27:54 EST (Tue, 17 Jan 2012)
New Revision: 76571
URL: http://svn.boost.org/trac/boost/changeset/76571

Log:
operator() requires Collection concept, calls access_element, which
should in turn require it too, but was using RandomCollection Concept.
Fixes ticket #5664.

Text files modified:
   trunk/boost/multi_array/base.hpp | 15 +++++++++++----
   1 files changed, 11 insertions(+), 4 deletions(-)

Modified: trunk/boost/multi_array/base.hpp
==============================================================================
--- trunk/boost/multi_array/base.hpp (original)
+++ trunk/boost/multi_array/base.hpp 2012-01-17 21:27:54 EST (Tue, 17 Jan 2012)
@@ -332,7 +332,8 @@
                            const size_type* extents,
                            const index* strides,
                            const index* index_bases) const {
-
+ boost::function_requires<
+ CollectionConcept<IndexList> >();
     ignore_unused_variable_warning(index_bases);
     ignore_unused_variable_warning(extents);
 #if !defined(NDEBUG) && !defined(BOOST_DISABLE_ASSERTS)
@@ -343,9 +344,15 @@
 #endif
 
     index offset = 0;
- for (size_type n = 0; n != NumDims; ++n)
- offset += indices[n] * strides[n];
-
+ {
+ typename IndexList::const_iterator i = indices.begin();
+ size_type n = 0;
+ while (n != NumDims) {
+ offset += (*i) * strides[n];
+ ++n;
+ ++i;
+ }
+ }
     return base[offset];
   }
 


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