From 19dba59f0256aae6a19ade2ab08c848d9a000a37 Mon Sep 17 00:00:00 2001 From: Ronald Garcia Date: Tue, 21 Aug 2007 13:54:58 +0000 Subject: [PATCH] Changed all uses of assert to BOOST_ASSERT. [SVN r38821] --- include/boost/multi_array/copy_array.hpp | 6 +++--- include/boost/multi_array/multi_array_ref.hpp | 20 +++++++++---------- include/boost/multi_array/subarray.hpp | 13 ++++++------ include/boost/multi_array/view.hpp | 18 ++++++++--------- 4 files changed, 28 insertions(+), 29 deletions(-) diff --git a/include/boost/multi_array/copy_array.hpp b/include/boost/multi_array/copy_array.hpp index 143ddda..f358b2b 100644 --- a/include/boost/multi_array/copy_array.hpp +++ b/include/boost/multi_array/copy_array.hpp @@ -19,7 +19,7 @@ // shape // #include "boost/type.hpp" -#include +#include "boost/assert.hpp" namespace boost { namespace detail { @@ -52,8 +52,8 @@ private: template void copy_array (Array1& source, Array2& dest) { - assert(std::equal(source.shape(),source.shape()+source.num_dimensions(), - dest.shape())); + BOOST_ASSERT(std::equal(source.shape(),source.shape()+source.num_dimensions(), + dest.shape())); // Dispatch to the proper function typedef typename Array1::element element_type; copy_dispatch:: diff --git a/include/boost/multi_array/multi_array_ref.hpp b/include/boost/multi_array/multi_array_ref.hpp index 41b962a..a8e0f7a 100644 --- a/include/boost/multi_array/multi_array_ref.hpp +++ b/include/boost/multi_array/multi_array_ref.hpp @@ -31,7 +31,6 @@ #include "boost/functional.hpp" #include "boost/limits.hpp" #include -#include #include #include #include @@ -165,9 +164,9 @@ public: void reshape(const SizeList& extents) { boost::function_requires< detail::multi_array::CollectionConcept >(); - assert(num_elements_ == - std::accumulate(extents.begin(),extents.end(), - size_type(1),std::multiplies())); + BOOST_ASSERT(num_elements_ == + std::accumulate(extents.begin(),extents.end(), + size_type(1),std::multiplies())); std::copy(extents.begin(),extents.end(),extent_list_.begin()); this->compute_strides(stride_list_,extent_list_,storage_); @@ -483,9 +482,9 @@ public: ConstMultiArrayConcept >(); // make sure the dimensions agree - assert(other.num_dimensions() == this->num_dimensions()); - assert(std::equal(other.shape(),other.shape()+this->num_dimensions(), - this->shape())); + BOOST_ASSERT(other.num_dimensions() == this->num_dimensions()); + BOOST_ASSERT(std::equal(other.shape(),other.shape()+this->num_dimensions(), + this->shape())); // iterator-based copy std::copy(other.begin(),other.end(),this->begin()); return *this; @@ -495,9 +494,10 @@ public: if (&other != this) { // make sure the dimensions agree - assert(other.num_dimensions() == this->num_dimensions()); - assert(std::equal(other.shape(),other.shape()+this->num_dimensions(), - this->shape())); + BOOST_ASSERT(other.num_dimensions() == this->num_dimensions()); + BOOST_ASSERT(std::equal(other.shape(), + other.shape()+this->num_dimensions(), + this->shape())); // iterator-based copy std::copy(other.begin(),other.end(),this->begin()); } diff --git a/include/boost/multi_array/subarray.hpp b/include/boost/multi_array/subarray.hpp index 359d00e..c336f82 100644 --- a/include/boost/multi_array/subarray.hpp +++ b/include/boost/multi_array/subarray.hpp @@ -235,9 +235,9 @@ public: ConstMultiArray, NumDims> >(); // make sure the dimensions agree - assert(other.num_dimensions() == this->num_dimensions()); - assert(std::equal(other.shape(),other.shape()+this->num_dimensions(), - this->shape())); + BOOST_ASSERT(other.num_dimensions() == this->num_dimensions()); + BOOST_ASSERT(std::equal(other.shape(),other.shape()+this->num_dimensions(), + this->shape())); // iterator-based copy std::copy(other.begin(),other.end(),begin()); return *this; @@ -247,9 +247,10 @@ public: sub_array& operator=(const sub_array& other) { if (&other != this) { // make sure the dimensions agree - assert(other.num_dimensions() == this->num_dimensions()); - assert(std::equal(other.shape(),other.shape()+this->num_dimensions(), - this->shape())); + BOOST_ASSERT(other.num_dimensions() == this->num_dimensions()); + BOOST_ASSERT(std::equal(other.shape(), + other.shape()+this->num_dimensions(), + this->shape())); // iterator-based copy std::copy(other.begin(),other.end(),begin()); } diff --git a/include/boost/multi_array/view.hpp b/include/boost/multi_array/view.hpp index 067fb02..75d698f 100644 --- a/include/boost/multi_array/view.hpp +++ b/include/boost/multi_array/view.hpp @@ -244,10 +244,7 @@ public: // should be protected // Calculate the array size num_elements_ = std::accumulate(extent_list_.begin(),extent_list_.end(), - size_type(1),std::multiplies()); -#if 0 - assert(num_elements_ != 0); -#endif + size_type(1),std::multiplies()); } typedef boost::array size_list; @@ -304,9 +301,9 @@ public: ConstMultiArrayConcept >(); // make sure the dimensions agree - assert(other.num_dimensions() == this->num_dimensions()); - assert(std::equal(other.shape(),other.shape()+this->num_dimensions(), - this->shape())); + BOOST_ASSERT(other.num_dimensions() == this->num_dimensions()); + BOOST_ASSERT(std::equal(other.shape(),other.shape()+this->num_dimensions(), + this->shape())); // iterator-based copy std::copy(other.begin(),other.end(),begin()); return *this; @@ -316,9 +313,10 @@ public: multi_array_view& operator=(const multi_array_view& other) { if (&other != this) { // make sure the dimensions agree - assert(other.num_dimensions() == this->num_dimensions()); - assert(std::equal(other.shape(),other.shape()+this->num_dimensions(), - this->shape())); + BOOST_ASSERT(other.num_dimensions() == this->num_dimensions()); + BOOST_ASSERT(std::equal(other.shape(), + other.shape()+this->num_dimensions(), + this->shape())); // iterator-based copy std::copy(other.begin(),other.end(),begin()); }