From e5909ce40984a43374fd480dde5b0860eb7009b9 Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Sat, 23 Nov 2002 18:17:43 +0000 Subject: [PATCH] Add super_type:: so 2-phase lookup works right [SVN r16378] --- include/boost/multi_array.hpp | 2 +- include/boost/multi_array/multi_array_ref.hpp | 26 +++++++++---------- include/boost/multi_array/subarray.hpp | 20 +++++++------- include/boost/multi_array/view.hpp | 24 ++++++++--------- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/include/boost/multi_array.hpp b/include/boost/multi_array.hpp index 69a1896..398c345 100644 --- a/include/boost/multi_array.hpp +++ b/include/boost/multi_array.hpp @@ -143,7 +143,7 @@ public: sub_array& rhs) : super_type(rhs) { allocate_space(); - std::copy(rhs.begin(),rhs.end(),begin()); + std::copy(rhs.begin(),rhs.end(),super_type::begin()); } // Since assignment is a deep copy, multi_array_ref diff --git a/include/boost/multi_array/multi_array_ref.hpp b/include/boost/multi_array/multi_array_ref.hpp index cdefb6c..45763d7 100644 --- a/include/boost/multi_array/multi_array_ref.hpp +++ b/include/boost/multi_array/multi_array_ref.hpp @@ -149,7 +149,7 @@ public: void reindex(index value) { index_base_list_.assign(value); origin_offset_ = - calculate_origin_offset(stride_list_,extent_list_, + super_type::calculate_origin_offset(stride_list_,extent_list_, storage_,index_base_list_); } @@ -467,18 +467,18 @@ public: if (&other != this) { // make sure the dimensions agree - assert(other.num_dimensions() == num_dimensions()); - assert(std::equal(other.shape(),other.shape()+num_dimensions(), - shape())); + assert(other.num_dimensions() == super_type::num_dimensions()); + assert(std::equal(other.shape(),other.shape()+super_type::num_dimensions(), + super_type::shape())); // iterator-based copy std::copy(other.begin(),other.end(),begin()); } return *this; } - element* origin() { return base_+origin_offset_; } + element* origin() { return super_type::base_+super_type::origin_offset_; } - element* data() { return base_; } + element* data() { return super_type::base_; } template element& operator()(const IndexList& indices) { @@ -493,8 +493,8 @@ public: reference operator[](index idx) { return super_type::access(boost::type(), idx,origin(), - shape(),strides(), - index_bases()); + super_type::shape(),super_type::strides(), + super_type::index_bases()); } @@ -519,13 +519,13 @@ public: iterator begin() { - return iterator(iter_base(*index_bases(),origin(),shape(), - strides(),index_bases())); + return iterator(iter_base(*super_type::index_bases(),origin(),super_type::shape(), + super_type::strides(),super_type::index_bases())); } iterator end() { - return iterator(iter_base(*index_bases()+*shape(),origin(), - shape(),strides(),index_bases())); + return iterator(iter_base(*super_type::index_bases()+*super_type::shape(),origin(), + super_type::shape(),super_type::strides(),super_type::index_bases())); } // RG - rbegin() and rend() written naively to thwart MSVC ICE. @@ -555,7 +555,7 @@ public: const_reference operator[](index idx) const { return super_type::access(boost::type(), idx,origin(), - shape(),strides(),index_bases()); + super_type::shape(),super_type::strides(),super_type::index_bases()); } // See note attached to generate_array_view in base.hpp diff --git a/include/boost/multi_array/subarray.hpp b/include/boost/multi_array/subarray.hpp index 2aa1070..bfa0c5c 100644 --- a/include/boost/multi_array/subarray.hpp +++ b/include/boost/multi_array/subarray.hpp @@ -247,21 +247,21 @@ public: sub_array& operator=(const sub_array& other) { if (&other != this) { // make sure the dimensions agree - assert(other.num_dimensions() == num_dimensions()); - assert(std::equal(other.shape(),other.shape()+num_dimensions(), - shape())); + assert(other.num_dimensions() == super_type::num_dimensions()); + assert(std::equal(other.shape(),other.shape()+super_type::num_dimensions(), + super_type::shape())); // iterator-based copy std::copy(other.begin(),other.end(),begin()); } return *this; } - T* origin() { return base_; } - const T* origin() const { return base_; } + T* origin() { return super_type::base_; } + const T* origin() const { return super_type::base_; } reference operator[](index idx) { return super_type::access(boost::type(), - idx,base_,shape(),strides(),index_bases()); + idx,super_type::base_,super_type::shape(),super_type::strides(),super_type::index_bases()); } // see generate_array_view in base.hpp @@ -291,13 +291,13 @@ public: } iterator begin() { - return iterator(iter_base(*index_bases(),origin(), - shape(),strides(),index_bases())); + return iterator(iter_base(*super_type::index_bases(),origin(), + super_type::shape(),super_type::strides(),super_type::index_bases())); } iterator end() { - return iterator(iter_base(*index_bases()+*shape(),origin(), - shape(),strides(),index_bases())); + return iterator(iter_base(*super_type::index_bases()+*super_type::shape(),origin(), + super_type::shape(),super_type::strides(),super_type::index_bases())); } // RG - rbegin() and rend() written naively to thwart MSVC ICE. diff --git a/include/boost/multi_array/view.hpp b/include/boost/multi_array/view.hpp index 5484c9d..36f5d1f 100644 --- a/include/boost/multi_array/view.hpp +++ b/include/boost/multi_array/view.hpp @@ -76,13 +76,13 @@ public: void reindex(const BaseList& values) { boost::copy_n(values.begin(),num_dimensions(),index_base_list_.begin()); origin_offset_ = - calculate_indexing_offset(stride_list_,index_base_list_); + super_type::calculate_indexing_offset(stride_list_,index_base_list_); } void reindex(index value) { index_base_list_.assign(value); origin_offset_ = - calculate_indexing_offset(stride_list_,index_base_list_); + super_type::calculate_indexing_offset(stride_list_,index_base_list_); } size_type num_dimensions() const { return NumDims; } @@ -303,16 +303,16 @@ public: multi_array_view& operator=(const multi_array_view& other) { if (&other != this) { // make sure the dimensions agree - assert(other.num_dimensions() == num_dimensions()); - assert(std::equal(other.shape(),other.shape()+num_dimensions(), - shape())); + assert(other.num_dimensions() == super_type::num_dimensions()); + assert(std::equal(other.shape(),other.shape()+super_type::num_dimensions(), + super_type::shape())); // iterator-based copy std::copy(other.begin(),other.end(),begin()); } return *this; } - element* origin() { return base_+origin_offset_; } + element* origin() { return super_type::base_+super_type::origin_offset_; } template element& operator()(const IndexList& indices) { @@ -325,8 +325,8 @@ public: reference operator[](index idx) { return super_type::access(boost::type(), idx,origin(), - shape(),strides(), - index_bases()); + super_type::shape(),super_type::strides(), + super_type::index_bases()); } @@ -351,13 +351,13 @@ public: iterator begin() { - return iterator(iter_base(*index_bases(),origin(), - shape(),strides(),index_bases())); + return iterator(iter_base(*super_type::index_bases(),origin(), + super_type::shape(),super_type::strides(),super_type::index_bases())); } iterator end() { - return iterator(iter_base(*index_bases()+*shape(),origin(), - shape(),strides(),index_bases())); + return iterator(iter_base(*super_type::index_bases()+*super_type::shape(),origin(), + super_type::shape(),super_type::strides(),super_type::index_bases())); } reverse_iterator rbegin() {