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,7 +52,7 @@ 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;

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,7 +164,7 @@ 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>()));
@ -483,8 +482,8 @@ 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());
@ -495,8 +494,9 @@ 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(),
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());

View File

@ -235,8 +235,8 @@ 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());
@ -247,8 +247,9 @@ 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(),
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());

View File

@ -245,9 +245,6 @@ 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,8 +301,8 @@ 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());
@ -316,8 +313,9 @@ 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(),
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());