From 0309a36305f68e0d793280f4461844293d5da5e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Mon, 14 Apr 2014 11:40:26 +0200 Subject: [PATCH 2/4] multi_array: fix GCC -Wshadow warnings Signed-off-by: Michael Stahl --- include/boost/multi_array.hpp | 24 ++++----- include/boost/multi_array/concept_checks.hpp | 38 ++++++------- include/boost/multi_array/extent_range.hpp | 8 +-- include/boost/multi_array/index_range.hpp | 12 ++--- include/boost/multi_array/multi_array_ref.hpp | 78 +++++++++++++-------------- include/boost/multi_array/storage_order.hpp | 8 +-- include/boost/multi_array/subarray.hpp | 8 +-- include/boost/multi_array/view.hpp | 8 +-- 8 files changed, 92 insertions(+), 92 deletions(-) diff --git a/include/boost/multi_array.hpp b/include/boost/multi_array.hpp index f459ce9..8193699 100644 --- a/include/boost/multi_array.hpp +++ b/include/boost/multi_array.hpp @@ -139,20 +139,20 @@ public: explicit multi_array() : super_type((T*)initial_base_,c_storage_order(), - /*index_bases=*/0, /*extents=*/0) { + /*index_bases=*/0, /*extents_=*/0) { allocate_space(); } template explicit multi_array( - ExtentList const& extents + ExtentList const& extents_ #ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING , typename mpl::if_< detail::multi_array::is_multi_array_impl, int&,int>::type* = 0 #endif ) : - super_type((T*)initial_base_,extents) { + super_type((T*)initial_base_,extents_) { boost::function_requires< detail::multi_array::CollectionConcept >(); allocate_space(); @@ -160,19 +160,19 @@ public: template - explicit multi_array(ExtentList const& extents, + explicit multi_array(ExtentList const& extents_, const general_storage_order& so) : - super_type((T*)initial_base_,extents,so) { + super_type((T*)initial_base_,extents_,so) { boost::function_requires< detail::multi_array::CollectionConcept >(); allocate_space(); } template - explicit multi_array(ExtentList const& extents, + explicit multi_array(ExtentList const& extents_, const general_storage_order& so, Allocator const& alloc) : - super_type((T*)initial_base_,extents,so), allocator_(alloc) { + super_type((T*)initial_base_,extents_,so), allocator_(alloc) { boost::function_requires< detail::multi_array::CollectionConcept >(); allocate_space(); @@ -381,7 +381,7 @@ public: template - multi_array& resize(const ExtentList& extents) { + multi_array& resize(const ExtentList& extents_) { boost::function_requires< detail::multi_array::CollectionConcept >(); @@ -390,7 +390,7 @@ public: for (int i=0; i != NumDims; ++i) { typedef typename gen_type::range range_type; - ranges.ranges_[i] = range_type(0,extents[i]); + ranges.ranges_[i] = range_type(0,extents_[i]); } return this->resize(ranges); @@ -423,9 +423,9 @@ public: // Build index_gen objects to create views with the same shape // these need to be separate to handle non-zero index bases - typedef detail::multi_array::index_gen index_gen; - index_gen old_idxes; - index_gen new_idxes; + typedef detail::multi_array::index_gen lcl_index_gen; + lcl_index_gen old_idxes; + lcl_index_gen new_idxes; std::transform(new_array.index_base_list_.begin(), new_array.index_base_list_.end(), diff --git a/include/boost/multi_array/concept_checks.hpp b/include/boost/multi_array/concept_checks.hpp index ea0c1aa..7e5ba5d 100644 --- a/include/boost/multi_array/concept_checks.hpp +++ b/include/boost/multi_array/concept_checks.hpp @@ -39,8 +39,8 @@ namespace detail { template static void call(Array& a, const IdxGen& idgen, Call_Type c) { - typedef typename Array::index_range index_range; - typedef typename Array::index index; + typedef typename Array::index_range index_range_; + typedef typename Array::index index_; idgen_helper::call(a,idgen[c],c); } }; @@ -50,8 +50,8 @@ namespace detail { template static void call(Array& a, const IdxGen& idgen, Call_Type) { - typedef typename Array::index_range index_range; - typedef typename Array::index index; + typedef typename Array::index_range index_range_; + typedef typename Array::index index_; a[ idgen ]; } }; @@ -166,27 +166,27 @@ namespace detail { const_constraints(a); } - void const_constraints(const Array& a) { + void const_constraints(const Array& a_) { // value_type vt = a[ id ]; // Test slicing, keeping only the first dimension, losing the rest - detail::idgen_helper::call(a,idgen[range],id); + detail::idgen_helper::call(a_,idgen[range],id); // Test slicing, keeping all dimensions. - detail::idgen_helper::call(a,idgen[range],range); - - st = a.size(); - st = a.num_dimensions(); - st = a.num_elements(); - stp = a.shape(); - idp = a.strides(); - idp = a.index_bases(); - cit = a.begin(); - cit = a.end(); - crit = a.rbegin(); - crit = a.rend(); - eltp = a.origin(); + detail::idgen_helper::call(a_,idgen[range],range); + + st = a_.size(); + st = a_.num_dimensions(); + st = a_.num_elements(); + stp = a_.shape(); + idp = a_.strides(); + idp = a_.index_bases(); + cit = a_.begin(); + cit = a_.end(); + crit = a_.rbegin(); + crit = a_.rend(); + eltp = a_.origin(); } typedef typename Array::value_type value_type; diff --git a/include/boost/multi_array/extent_range.hpp b/include/boost/multi_array/extent_range.hpp index d7a2eaf..b6d7706 100644 --- a/include/boost/multi_array/extent_range.hpp +++ b/include/boost/multi_array/extent_range.hpp @@ -26,11 +26,11 @@ public: typedef Extent index; typedef SizeType size_type; - extent_range(index start, index finish) : - super_type(start,finish) { } + extent_range(index start_, index finish_) : + super_type(start_,finish_) { } - extent_range(index finish) : - super_type(0,finish) { } + extent_range(index finish_) : + super_type(0,finish_) { } extent_range() : super_type(0,0) { } diff --git a/include/boost/multi_array/index_range.hpp b/include/boost/multi_array/index_range.hpp index 3d6035e..42cd351 100644 --- a/include/boost/multi_array/index_range.hpp +++ b/include/boost/multi_array/index_range.hpp @@ -60,8 +60,8 @@ namespace multi_array { degenerate_ = true; } - explicit index_range(index start, index finish, index stride=1) - : start_(start), finish_(finish), stride_(stride), + explicit index_range(index i_start, index i_finish, index i_stride=1) + : start_(i_start), finish_(i_finish), stride_(i_stride), degenerate_(false) { } @@ -107,11 +107,11 @@ namespace multi_array { index stride() const { return stride_; } - void set_index_range(index start, index finish, index stride=1) + void set_index_range(index i_start, index i_finish, index i_stride=1) { - start_ = start; - finish_ = finish; - stride_ = stride; + start_ = i_start; + finish_ = i_finish; + stride_ = i_stride; } static index_range all() diff --git a/include/boost/multi_array/multi_array_ref.hpp b/include/boost/multi_array/multi_array_ref.hpp index 92e8fb4..511c816 100644 --- a/include/boost/multi_array/multi_array_ref.hpp +++ b/include/boost/multi_array/multi_array_ref.hpp @@ -87,24 +87,24 @@ public: num_elements_(other.num_elements_) { } template - explicit const_multi_array_ref(TPtr base, const ExtentList& extents) : + explicit const_multi_array_ref(TPtr base, const ExtentList& extents_) : base_(base), storage_(c_storage_order()) { boost::function_requires< CollectionConcept >(); index_base_list_.assign(0); - init_multi_array_ref(extents.begin()); + init_multi_array_ref(extents_.begin()); } template - explicit const_multi_array_ref(TPtr base, const ExtentList& extents, + explicit const_multi_array_ref(TPtr base, const ExtentList& extents_, const general_storage_order& so) : base_(base), storage_(so) { boost::function_requires< CollectionConcept >(); index_base_list_.assign(0); - init_multi_array_ref(extents.begin()); + init_multi_array_ref(extents_.begin()); } explicit const_multi_array_ref(TPtr base, @@ -125,13 +125,13 @@ public: } template - void assign(InputIterator begin, InputIterator end) { + void assign(InputIterator begin_, InputIterator end_) { boost::function_requires >(); - InputIterator in_iter = begin; + InputIterator in_iter = begin_; T* out_iter = base_; std::size_t copy_count=0; - while (in_iter != end && copy_count < num_elements_) { + while (in_iter != end_ && copy_count < num_elements_) { *out_iter++ = *in_iter++; copy_count++; } @@ -162,14 +162,14 @@ public: } template - void reshape(const SizeList& extents) { + void reshape(const SizeList& extents_) { boost::function_requires< CollectionConcept >(); BOOST_ASSERT(num_elements_ == - std::accumulate(extents.begin(),extents.end(), + std::accumulate(extents_.begin(),extents_.end(), size_type(1),std::multiplies())); - std::copy(extents.begin(),extents.end(),extent_list_.begin()); + std::copy(extents_.begin(),extents_.end(),extent_list_.begin()); this->compute_strides(stride_list_,extent_list_,storage_); origin_offset_ = @@ -209,11 +209,11 @@ public: } template - const element& operator()(IndexList indices) const { + const element& operator()(IndexList indices_) const { boost::function_requires< CollectionConcept >(); return super_type::access_element(boost::type(), - indices,origin(), + indices_,origin(), shape(),strides(),index_bases()); } @@ -232,12 +232,12 @@ public: #endif // BOOST_MSVC typename const_array_view::type operator[](const detail::multi_array:: - index_gen& indices) + index_gen& indices_) const { typedef typename const_array_view::type return_type; return super_type::generate_array_view(boost::type(), - indices, + indices_, shape(), strides(), index_bases(), @@ -328,20 +328,20 @@ public: explicit const_multi_array_ref(TPtr base, const storage_order_type& so, - const index * index_bases, - const size_type* extents) : + const index * index_bases_, + const size_type* extents_) : base_(base), storage_(so), origin_offset_(0), directional_offset_(0) { - // If index_bases or extents is null, then initialize the corresponding + // If index_bases_ or extents_ is null, then initialize the corresponding // private data to zeroed lists. - if(index_bases) { + if(index_bases_) { boost::detail::multi_array:: - copy_n(index_bases,NumDims,index_base_list_.begin()); + copy_n(index_bases_,NumDims,index_base_list_.begin()); } else { std::fill_n(index_base_list_.begin(),NumDims,0); } - if(extents) { - init_multi_array_ref(extents); + if(extents_) { + init_multi_array_ref(extents_); } else { boost::array extent_list; extent_list.assign(0); @@ -375,12 +375,12 @@ private: boost::mem_fun_ref(&extent_range::start)); // calculate the extents - extent_list extents; + extent_list extents_; std::transform(ranges.ranges_.begin(),ranges.ranges_.end(), - extents.begin(), + extents_.begin(), boost::mem_fun_ref(&extent_range::size)); - init_multi_array_ref(extents.begin()); + init_multi_array_ref(extents_.begin()); } @@ -446,16 +446,16 @@ public: }; template - explicit multi_array_ref(T* base, const ExtentList& extents) : - super_type(base,extents) { + explicit multi_array_ref(T* base, const ExtentList& extents_) : + super_type(base,extents_) { boost::function_requires< CollectionConcept >(); } template - explicit multi_array_ref(T* base, const ExtentList& extents, + explicit multi_array_ref(T* base, const ExtentList& extents_, const general_storage_order& so) : - super_type(base,extents,so) { + super_type(base,extents_,so) { boost::function_requires< CollectionConcept >(); } @@ -510,11 +510,11 @@ public: element* data() { return super_type::base_; } template - element& operator()(const IndexList& indices) { + element& operator()(const IndexList& indices_) { boost::function_requires< CollectionConcept >(); return super_type::access_element(boost::type(), - indices,origin(), + indices_,origin(), this->shape(),this->strides(), this->index_bases()); } @@ -536,11 +536,11 @@ public: #endif // BOOST_MSVC typename array_view::type operator[](const detail::multi_array:: - index_gen& indices) { + index_gen& indices_) { typedef typename array_view::type return_type; return super_type::generate_array_view(boost::type(), - indices, + indices_, this->shape(), this->strides(), this->index_bases(), @@ -577,10 +577,10 @@ public: const element* data() const { return super_type::data(); } template - const element& operator()(const IndexList& indices) const { + const element& operator()(const IndexList& indices_) const { boost::function_requires< CollectionConcept >(); - return super_type::operator()(indices); + return super_type::operator()(indices_); } const_reference operator[](index idx) const { @@ -598,9 +598,9 @@ public: #endif // BOOST_MSVC typename const_array_view::type operator[](const detail::multi_array:: - index_gen& indices) + index_gen& indices_) const { - return super_type::operator[](indices); + return super_type::operator[](indices_); } const_iterator begin() const { @@ -623,9 +623,9 @@ protected: // This is only supplied to support multi_array's default constructor explicit multi_array_ref(T* base, const storage_order_type& so, - const index* index_bases, - const size_type* extents) : - super_type(base,so,index_bases,extents) { } + const index* index_bases_, + const size_type* extents_) : + super_type(base,so,index_bases_,extents_) { } }; diff --git a/include/boost/multi_array/storage_order.hpp b/include/boost/multi_array/storage_order.hpp index 3eb7136..219f24d 100644 --- a/include/boost/multi_array/storage_order.hpp +++ b/include/boost/multi_array/storage_order.hpp @@ -34,10 +34,10 @@ namespace boost { public: typedef detail::multi_array::size_type size_type; template - general_storage_order(OrderingIter ordering, - AscendingIter ascending) { - boost::detail::multi_array::copy_n(ordering,NumDims,ordering_.begin()); - boost::detail::multi_array::copy_n(ascending,NumDims,ascending_.begin()); + general_storage_order(OrderingIter i_ordering, + AscendingIter i_ascending) { + boost::detail::multi_array::copy_n(i_ordering,NumDims,ordering_.begin()); + boost::detail::multi_array::copy_n(i_ascending,NumDims,ascending_.begin()); } // RG - ideally these would not be necessary, but some compilers diff --git a/include/boost/multi_array/subarray.hpp b/include/boost/multi_array/subarray.hpp index a498916..cc8b7f4 100644 --- a/include/boost/multi_array/subarray.hpp +++ b/include/boost/multi_array/subarray.hpp @@ -181,9 +181,9 @@ public: // Should be protected const_sub_array (TPtr base, const size_type* extents, - const index* strides, + const index* i_strides, const index* index_base) : - base_(base), extents_(extents), strides_(strides), + base_(base), extents_(extents), strides_(i_strides), index_base_(index_base) { } @@ -369,9 +369,9 @@ public: // should be private sub_array (T* base, const size_type* extents, - const index* strides, + const index* _strides, const index* index_base) : - super_type(base,extents,strides,index_base) { + super_type(base,extents,_strides,index_base) { } }; diff --git a/include/boost/multi_array/view.hpp b/include/boost/multi_array/view.hpp index d11e260..2f692a8 100644 --- a/include/boost/multi_array/view.hpp +++ b/include/boost/multi_array/view.hpp @@ -232,7 +232,7 @@ public: // should be protected template explicit const_multi_array_view(TPtr base, const ExtentList& extents, - const boost::array& strides): + const boost::array& strides_): base_(base), origin_offset_(0) { index_base_list_.assign(0); @@ -241,7 +241,7 @@ public: // should be protected boost::detail::multi_array:: copy_n(extents.begin(),NumDims,extent_list_.begin()); boost::detail::multi_array:: - copy_n(strides.begin(),NumDims,stride_list_.begin()); + copy_n(strides_.begin(),NumDims,stride_list_.begin()); // Calculate the array size num_elements_ = std::accumulate(extent_list_.begin(),extent_list_.end(), @@ -442,8 +442,8 @@ public: // should be private template explicit multi_array_view(T* base, const ExtentList& extents, - const boost::array& strides) : - super_type(base,extents,strides) { } + const boost::array& _strides) : + super_type(base,extents,_strides) { } }; -- 1.8.3.1