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 // shape
// //
#include "boost/type.hpp" #include "boost/type.hpp"
#include <cassert> #include "boost/assert.hpp"
namespace boost { namespace boost {
namespace detail { namespace detail {
@ -52,8 +52,8 @@ private:
template <typename Array1, typename Array2> template <typename Array1, typename Array2>
void copy_array (Array1& source, Array2& dest) { void copy_array (Array1& source, Array2& dest) {
assert(std::equal(source.shape(),source.shape()+source.num_dimensions(), BOOST_ASSERT(std::equal(source.shape(),source.shape()+source.num_dimensions(),
dest.shape())); dest.shape()));
// Dispatch to the proper function // Dispatch to the proper function
typedef typename Array1::element element_type; typedef typename Array1::element element_type;
copy_dispatch<element_type>:: copy_dispatch<element_type>::

View File

@ -31,7 +31,6 @@
#include "boost/functional.hpp" #include "boost/functional.hpp"
#include "boost/limits.hpp" #include "boost/limits.hpp"
#include <algorithm> #include <algorithm>
#include <cassert>
#include <cstddef> #include <cstddef>
#include <functional> #include <functional>
#include <numeric> #include <numeric>
@ -165,9 +164,9 @@ public:
void reshape(const SizeList& extents) { void reshape(const SizeList& extents) {
boost::function_requires< boost::function_requires<
detail::multi_array::CollectionConcept<SizeList> >(); detail::multi_array::CollectionConcept<SizeList> >();
assert(num_elements_ == BOOST_ASSERT(num_elements_ ==
std::accumulate(extents.begin(),extents.end(), std::accumulate(extents.begin(),extents.end(),
size_type(1),std::multiplies<size_type>())); size_type(1),std::multiplies<size_type>()));
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_); this->compute_strides(stride_list_,extent_list_,storage_);
@ -483,9 +482,9 @@ public:
ConstMultiArrayConcept<ConstMultiArray,NumDims> >(); ConstMultiArrayConcept<ConstMultiArray,NumDims> >();
// make sure the dimensions agree // make sure the dimensions agree
assert(other.num_dimensions() == this->num_dimensions()); BOOST_ASSERT(other.num_dimensions() == this->num_dimensions());
assert(std::equal(other.shape(),other.shape()+this->num_dimensions(), BOOST_ASSERT(std::equal(other.shape(),other.shape()+this->num_dimensions(),
this->shape())); this->shape()));
// iterator-based copy // iterator-based copy
std::copy(other.begin(),other.end(),this->begin()); std::copy(other.begin(),other.end(),this->begin());
return *this; return *this;
@ -495,9 +494,10 @@ public:
if (&other != this) { if (&other != this) {
// make sure the dimensions agree // make sure the dimensions agree
assert(other.num_dimensions() == this->num_dimensions()); BOOST_ASSERT(other.num_dimensions() == this->num_dimensions());
assert(std::equal(other.shape(),other.shape()+this->num_dimensions(), BOOST_ASSERT(std::equal(other.shape(),
this->shape())); other.shape()+this->num_dimensions(),
this->shape()));
// iterator-based copy // iterator-based copy
std::copy(other.begin(),other.end(),this->begin()); std::copy(other.begin(),other.end(),this->begin());
} }

View File

@ -235,9 +235,9 @@ public:
ConstMultiArray, NumDims> >(); ConstMultiArray, NumDims> >();
// make sure the dimensions agree // make sure the dimensions agree
assert(other.num_dimensions() == this->num_dimensions()); BOOST_ASSERT(other.num_dimensions() == this->num_dimensions());
assert(std::equal(other.shape(),other.shape()+this->num_dimensions(), BOOST_ASSERT(std::equal(other.shape(),other.shape()+this->num_dimensions(),
this->shape())); this->shape()));
// iterator-based copy // iterator-based copy
std::copy(other.begin(),other.end(),begin()); std::copy(other.begin(),other.end(),begin());
return *this; return *this;
@ -247,9 +247,10 @@ public:
sub_array& operator=(const sub_array& other) { sub_array& operator=(const sub_array& other) {
if (&other != this) { if (&other != this) {
// make sure the dimensions agree // make sure the dimensions agree
assert(other.num_dimensions() == this->num_dimensions()); BOOST_ASSERT(other.num_dimensions() == this->num_dimensions());
assert(std::equal(other.shape(),other.shape()+this->num_dimensions(), BOOST_ASSERT(std::equal(other.shape(),
this->shape())); other.shape()+this->num_dimensions(),
this->shape()));
// iterator-based copy // iterator-based copy
std::copy(other.begin(),other.end(),begin()); std::copy(other.begin(),other.end(),begin());
} }

View File

@ -244,10 +244,7 @@ public: // should be protected
// Calculate the array size // Calculate the array size
num_elements_ = std::accumulate(extent_list_.begin(),extent_list_.end(), num_elements_ = std::accumulate(extent_list_.begin(),extent_list_.end(),
size_type(1),std::multiplies<size_type>()); size_type(1),std::multiplies<size_type>());
#if 0
assert(num_elements_ != 0);
#endif
} }
typedef boost::array<size_type,NumDims> size_list; typedef boost::array<size_type,NumDims> size_list;
@ -304,9 +301,9 @@ public:
ConstMultiArrayConcept<ConstMultiArray,NumDims> >(); ConstMultiArrayConcept<ConstMultiArray,NumDims> >();
// make sure the dimensions agree // make sure the dimensions agree
assert(other.num_dimensions() == this->num_dimensions()); BOOST_ASSERT(other.num_dimensions() == this->num_dimensions());
assert(std::equal(other.shape(),other.shape()+this->num_dimensions(), BOOST_ASSERT(std::equal(other.shape(),other.shape()+this->num_dimensions(),
this->shape())); this->shape()));
// iterator-based copy // iterator-based copy
std::copy(other.begin(),other.end(),begin()); std::copy(other.begin(),other.end(),begin());
return *this; return *this;
@ -316,9 +313,10 @@ public:
multi_array_view& operator=(const multi_array_view& other) { multi_array_view& operator=(const multi_array_view& other) {
if (&other != this) { if (&other != this) {
// make sure the dimensions agree // make sure the dimensions agree
assert(other.num_dimensions() == this->num_dimensions()); BOOST_ASSERT(other.num_dimensions() == this->num_dimensions());
assert(std::equal(other.shape(),other.shape()+this->num_dimensions(), BOOST_ASSERT(std::equal(other.shape(),
this->shape())); other.shape()+this->num_dimensions(),
this->shape()));
// iterator-based copy // iterator-based copy
std::copy(other.begin(),other.end(),begin()); std::copy(other.begin(),other.end(),begin());
} }