Changed all uses of assert to BOOST_ASSERT.

[SVN r38821]
This commit is contained in:
Ronald Garcia 2007-08-21 13:54:58 +00:00
parent f68a2203b3
commit 19dba59f02
4 changed files with 28 additions and 29 deletions

View File

@ -19,7 +19,7 @@
// shape
//
#include "boost/type.hpp"
#include <cassert>
#include "boost/assert.hpp"
namespace boost {
namespace detail {
@ -52,8 +52,8 @@ private:
template <typename Array1, typename Array2>
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<element_type>::

View File

@ -31,7 +31,6 @@
#include "boost/functional.hpp"
#include "boost/limits.hpp"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <functional>
#include <numeric>
@ -165,9 +164,9 @@ public:
void reshape(const SizeList& extents) {
boost::function_requires<
detail::multi_array::CollectionConcept<SizeList> >();
assert(num_elements_ ==
std::accumulate(extents.begin(),extents.end(),
size_type(1),std::multiplies<size_type>()));
BOOST_ASSERT(num_elements_ ==
std::accumulate(extents.begin(),extents.end(),
size_type(1),std::multiplies<size_type>()));
std::copy(extents.begin(),extents.end(),extent_list_.begin());
this->compute_strides(stride_list_,extent_list_,storage_);
@ -483,9 +482,9 @@ public:
ConstMultiArrayConcept<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(),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());
}

View File

@ -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());
}

View File

@ -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<size_type>());
#if 0
assert(num_elements_ != 0);
#endif
size_type(1),std::multiplies<size_type>());
}
typedef boost::array<size_type,NumDims> size_list;
@ -304,9 +301,9 @@ public:
ConstMultiArrayConcept<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;
@ -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());
}