mirror of
https://github.com/boostorg/multi_array.git
synced 2026-01-25 18:32:13 +00:00
Compare commits
2 Commits
boost-1.32
...
boost-1.31
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
24d1980304 | ||
|
|
f34bc373f2 |
@@ -20,13 +20,13 @@
|
||||
<table border="1" bgcolor="#007f7f" cellpadding="2">
|
||||
<tbody><tr>
|
||||
<td bgcolor="#ffffff">
|
||||
<img src="../../../boost.png" alt="boost logo"
|
||||
<img src="../../../c++boost.gif" alt="boost logo"
|
||||
width="277" align="middle" height="86"></td>
|
||||
<td><a href="../../../index.htm"><font face="Arial" color="#ffffff"><big>Home</big></font></a></td>
|
||||
<td><a href="../../../libs/libraries.htm"><font face="Arial" color="#ffffff"><big>Libraries</big></font></a></td>
|
||||
<td><a href="../../../people/people.htm"><font face="Arial" color="#ffffff"><big>People</big></font></a></td>
|
||||
<td><a href="../../../more/faq.htm"><font face="Arial" color="#ffffff"><big>FAQ</big></font></a></td>
|
||||
<td><a href="../../../more/index.htm"><font face="Arial" color="#ffffff"><big>More</big></font></a></td>
|
||||
<td><a href="http://www.boost.org/index.htm"><font face="Arial" color="#ffffff"><big>Home</big></font></a></td>
|
||||
<td><a href="http://www.boost.org/libs/libraries.htm"><font face="Arial" color="#ffffff"><big>Libraries</big></font></a></td>
|
||||
<td><a href="http://www.boost.org/people/people.htm"><font face="Arial" color="#ffffff"><big>People</big></font></a></td>
|
||||
<td><a href="http://www.boost.org/more/faq.htm"><font face="Arial" color="#ffffff"><big>FAQ</big></font></a></td>
|
||||
<td><a href="http://www.boost.org/more/index.htm"><font face="Arial" color="#ffffff"><big>More</big></font></a></td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
<h1>Boost.MultiArray</h1>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<body>
|
||||
|
||||
<h1>
|
||||
<img src="../../../boost.png" alt="boost logo"
|
||||
<img src="../../../c++boost.gif" alt="boost logo"
|
||||
width="277" align="middle" height="86">
|
||||
<br>Boost.MultiArray: Extra Notes
|
||||
<br>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,7 +20,7 @@ Boost.MultiArray: Test Descriptions
|
||||
</title>
|
||||
</head>
|
||||
<body bgcolor="#ffffff" text="#000000">
|
||||
<IMG SRC="http://www.boost.org/boost.png"
|
||||
<IMG SRC="http://www.boost.org/c++boost.gif"
|
||||
ALT="C++ Boost" width="277" height="86">
|
||||
<h1>Boost.MultiArray: Test Descriptions</h1>
|
||||
|
||||
@@ -99,14 +99,6 @@ Tests out <tt>operator=()</tt> on the various B.M array types.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="../test/assign_to_array.cpp">libs/multi_array/test/assign_to_array.cpp</a></td>
|
||||
<td>
|
||||
Ensure that a <tt>multi_array</tt> can be constructed from any other
|
||||
array type.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="../test/index_bases.cpp">libs/multi_array/test/index_bases.cpp</a></td>
|
||||
<td>
|
||||
@@ -150,13 +142,6 @@ Test interaction between array types and STL containers.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="../test/resize.cpp">libs/multi_array/test/resize.cpp</a></td>
|
||||
<td>
|
||||
Test the <tt>multi_array</tt> class' resizing functionality.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a href="../test/concept_checks.cpp">libs/multi_array/test/concept_checks.cpp</a></td>
|
||||
<td>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<body>
|
||||
|
||||
<h1>
|
||||
<img src="../../../boost.png" alt="boost logo"
|
||||
<img src="../../../c++boost.gif" alt="boost logo"
|
||||
width="277" align="middle" height="86">
|
||||
<br>The Boost Multidimensional Array Library
|
||||
<br>(Boost.MultiArray)
|
||||
|
||||
@@ -77,7 +77,7 @@ occurs when a single-index is specified to
|
||||
</programlisting>
|
||||
|
||||
has a degenerate second dimension. The view generated from the above
|
||||
specification will have 2 dimensions with shape <literal>5 x 4</literal>.
|
||||
specification will have 2 dimensions with shape <literal>5 x 2</literal>.
|
||||
If the "<literal>2</literal>" above were replaced with
|
||||
another <literal>index_range</literal> object, for example:
|
||||
|
||||
|
||||
@@ -72,14 +72,6 @@ public:
|
||||
const storage_order_type& store = c_storage_order(),
|
||||
const Allocator& alloc = Allocator());
|
||||
multi_array(const multi_array& x);
|
||||
multi_array(const const_multi_array_ref<ValueType,NumDims>& x);
|
||||
multi_array(const const_subarray<NumDims>::type& x);
|
||||
multi_array(const const_array_view<NumDims>::type& x);
|
||||
|
||||
multi_array(const multi_array_ref<ValueType,NumDims>& x);
|
||||
multi_array(const subarray<NumDims>::type& x);
|
||||
multi_array(const array_view<NumDims>::type& x);
|
||||
|
||||
~multi_array();
|
||||
|
||||
// modifiers
|
||||
@@ -201,17 +193,11 @@ elements.
|
||||
|
||||
<varlistentry>
|
||||
<term><programlisting>
|
||||
<![CDATA[multi_array(const multi_array& x);
|
||||
multi_array(const const_multi_array_ref<ValueType,NumDims>& x);
|
||||
multi_array(const const_subarray<NumDims>::type& x);
|
||||
multi_array(const const_array_view<NumDims>::type& x);
|
||||
multi_array(const multi_array_ref<ValueType,NumDims>& x);
|
||||
multi_array(const subarray<NumDims>::type& x);
|
||||
multi_array(const array_view<NumDims>::type& x);]]>
|
||||
<![CDATA[multi_array(const multi_array& x);]]>
|
||||
</programlisting></term>
|
||||
<listitem>
|
||||
<para>These constructors all constructs a <literal>multi_array</literal> and
|
||||
perform a deep copy of <literal>x</literal>.
|
||||
<para>This constructs a <literal>multi_array</literal> and performs a deep
|
||||
copy of <literal>x</literal>.
|
||||
</para>
|
||||
|
||||
<formalpara>
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "boost/multi_array/multi_array_ref.hpp"
|
||||
#include "boost/multi_array/algorithm.hpp"
|
||||
#include "boost/array.hpp"
|
||||
#include "boost/mpl/if.hpp"
|
||||
#include "boost/type_traits.hpp"
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
@@ -39,7 +38,6 @@
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
namespace multi_array {
|
||||
|
||||
struct populate_index_ranges {
|
||||
multi_array_types::index_range
|
||||
operator()(multi_array_types::index base,
|
||||
@@ -47,61 +45,6 @@ namespace boost {
|
||||
return multi_array_types::index_range(base,base+extent);
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
//
|
||||
// Compilers that don't support partial ordering may need help to
|
||||
// disambiguate multi_array's templated constructors. Even vc6/7 are
|
||||
// capable of some limited SFINAE, so we take the most-general version
|
||||
// out of the overload set with disable_multi_array_impl.
|
||||
//
|
||||
template <typename T, std::size_t NumDims, typename TPtr>
|
||||
char is_multi_array_impl_help(const_multi_array_view<T,NumDims,TPtr>&);
|
||||
template <typename T, std::size_t NumDims, typename TPtr>
|
||||
char is_multi_array_impl_help(const_sub_array<T,NumDims,TPtr>&);
|
||||
template <typename T, std::size_t NumDims, typename TPtr>
|
||||
char is_multi_array_impl_help(const_multi_array_ref<T,NumDims,TPtr>&);
|
||||
|
||||
char ( &is_multi_array_impl_help(...) )[2];
|
||||
|
||||
template <class T>
|
||||
struct is_multi_array_impl
|
||||
{
|
||||
static T x;
|
||||
BOOST_STATIC_CONSTANT(bool, value = sizeof((is_multi_array_impl_help)(x)) == 1);
|
||||
|
||||
typedef mpl::bool_<value> type;
|
||||
};
|
||||
|
||||
template <bool multi_array = false>
|
||||
struct disable_multi_array_impl_impl
|
||||
{
|
||||
typedef int type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct disable_multi_array_impl_impl<true>
|
||||
{
|
||||
// forming a pointer to a reference triggers SFINAE
|
||||
typedef int& type;
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
struct disable_multi_array_impl :
|
||||
disable_multi_array_impl_impl<is_multi_array_impl<T>::value>
|
||||
{ };
|
||||
|
||||
|
||||
template <>
|
||||
struct disable_multi_array_impl<int>
|
||||
{
|
||||
typedef int type;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
} //namespace multi_array
|
||||
} // namespace detail
|
||||
|
||||
@@ -137,26 +80,22 @@ public:
|
||||
};
|
||||
|
||||
explicit multi_array() :
|
||||
super_type((T*)initial_base_,c_storage_order(),
|
||||
/*index_bases=*/0, /*extents=*/0) {
|
||||
allocate_space();
|
||||
super_type((T*)initial_base_) {
|
||||
allocate_space();
|
||||
}
|
||||
|
||||
|
||||
template <class ExtentList>
|
||||
explicit multi_array(
|
||||
ExtentList const& extents
|
||||
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
, typename mpl::if_<
|
||||
detail::multi_array::is_multi_array_impl<ExtentList>,
|
||||
int&,int>::type* = 0
|
||||
#endif
|
||||
) :
|
||||
, typename detail::multi_array::disable_non_sub_array<ExtentList>::type* = 0
|
||||
#endif
|
||||
) :
|
||||
super_type((T*)initial_base_,extents) {
|
||||
boost::function_requires<
|
||||
detail::multi_array::CollectionConcept<ExtentList> >();
|
||||
allocate_space();
|
||||
}
|
||||
|
||||
|
||||
template <class ExtentList>
|
||||
explicit multi_array(ExtentList const& extents,
|
||||
@@ -210,155 +149,20 @@ public:
|
||||
boost::copy_n(rhs.base_,rhs.num_elements(),base_);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// A multi_array is constructible from any multi_array_ref, subarray, or
|
||||
// array_view object. The following constructors ensure that.
|
||||
//
|
||||
|
||||
// Due to limited support for partial template ordering,
|
||||
// MSVC 6&7 confuse the following with the most basic ExtentList
|
||||
// constructor.
|
||||
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
template <typename OPtr>
|
||||
multi_array(const const_multi_array_ref<T,NumDims,OPtr>& rhs,
|
||||
const general_storage_order<NumDims>& so = c_storage_order())
|
||||
: super_type(0,so,rhs.index_bases(),rhs.shape())
|
||||
{
|
||||
allocate_space();
|
||||
// Warning! storage order may change, hence the following copy technique.
|
||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||
}
|
||||
|
||||
template <typename OPtr>
|
||||
multi_array(const detail::multi_array::
|
||||
const_sub_array<T,NumDims,OPtr>& rhs,
|
||||
const general_storage_order<NumDims>& so = c_storage_order())
|
||||
: super_type(0,so,rhs.index_bases(),rhs.shape())
|
||||
{
|
||||
const_sub_array<T,NumDims,OPtr>& rhs) :
|
||||
super_type(rhs) {
|
||||
allocate_space();
|
||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||
}
|
||||
|
||||
|
||||
template <typename OPtr>
|
||||
// For some reason, gcc 2.95.2 doesn't pick the above template
|
||||
// member function when passed a subarray, so i was forced to
|
||||
// duplicate the functionality here...
|
||||
multi_array(const detail::multi_array::
|
||||
const_multi_array_view<T,NumDims,OPtr>& rhs,
|
||||
const general_storage_order<NumDims>& so = c_storage_order())
|
||||
: super_type(0,so,rhs.index_bases(),rhs.shape())
|
||||
{
|
||||
allocate_space();
|
||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||
}
|
||||
|
||||
#else // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
// More limited support for MSVC
|
||||
|
||||
|
||||
multi_array(const const_multi_array_ref<T,NumDims>& rhs)
|
||||
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape())
|
||||
{
|
||||
allocate_space();
|
||||
// Warning! storage order may change, hence the following copy technique.
|
||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||
}
|
||||
|
||||
multi_array(const const_multi_array_ref<T,NumDims>& rhs,
|
||||
const general_storage_order<NumDims>& so)
|
||||
: super_type(0,so,rhs.index_bases(),rhs.shape())
|
||||
{
|
||||
allocate_space();
|
||||
// Warning! storage order may change, hence the following copy technique.
|
||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||
}
|
||||
|
||||
multi_array(const detail::multi_array::
|
||||
const_sub_array<T,NumDims>& rhs)
|
||||
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape())
|
||||
{
|
||||
allocate_space();
|
||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||
}
|
||||
|
||||
multi_array(const detail::multi_array::
|
||||
const_sub_array<T,NumDims>& rhs,
|
||||
const general_storage_order<NumDims>& so)
|
||||
: super_type(0,so,rhs.index_bases(),rhs.shape())
|
||||
{
|
||||
allocate_space();
|
||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||
}
|
||||
|
||||
|
||||
multi_array(const detail::multi_array::
|
||||
const_multi_array_view<T,NumDims>& rhs)
|
||||
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape())
|
||||
{
|
||||
allocate_space();
|
||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||
}
|
||||
|
||||
multi_array(const detail::multi_array::
|
||||
const_multi_array_view<T,NumDims>& rhs,
|
||||
const general_storage_order<NumDims>& so)
|
||||
: super_type(0,so,rhs.index_bases(),rhs.shape())
|
||||
{
|
||||
allocate_space();
|
||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||
}
|
||||
|
||||
#endif // !BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
// Thes constructors are necessary because of more exact template matches.
|
||||
multi_array(const multi_array_ref<T,NumDims>& rhs)
|
||||
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape())
|
||||
{
|
||||
allocate_space();
|
||||
// Warning! storage order may change, hence the following copy technique.
|
||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||
}
|
||||
|
||||
multi_array(const multi_array_ref<T,NumDims>& rhs,
|
||||
const general_storage_order<NumDims>& so)
|
||||
: super_type(0,so,rhs.index_bases(),rhs.shape())
|
||||
{
|
||||
allocate_space();
|
||||
// Warning! storage order may change, hence the following copy technique.
|
||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||
}
|
||||
|
||||
|
||||
multi_array(const detail::multi_array::
|
||||
sub_array<T,NumDims>& rhs)
|
||||
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape())
|
||||
{
|
||||
allocate_space();
|
||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||
}
|
||||
|
||||
multi_array(const detail::multi_array::
|
||||
sub_array<T,NumDims>& rhs,
|
||||
const general_storage_order<NumDims>& so)
|
||||
: super_type(0,so,rhs.index_bases(),rhs.shape())
|
||||
{
|
||||
allocate_space();
|
||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||
}
|
||||
|
||||
|
||||
multi_array(const detail::multi_array::
|
||||
multi_array_view<T,NumDims>& rhs)
|
||||
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape())
|
||||
{
|
||||
allocate_space();
|
||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||
}
|
||||
|
||||
multi_array(const detail::multi_array::
|
||||
multi_array_view<T,NumDims>& rhs,
|
||||
const general_storage_order<NumDims>& so)
|
||||
: super_type(0,so,rhs.index_bases(),rhs.shape())
|
||||
{
|
||||
sub_array<T,NumDims>& rhs) :
|
||||
super_type(rhs) {
|
||||
allocate_space();
|
||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "boost/multi_array/storage_order.hpp"
|
||||
#include "boost/multi_array/types.hpp"
|
||||
#include "boost/config.hpp"
|
||||
#include "boost/mpl/eval_if.hpp"
|
||||
#include "boost/mpl/apply_if.hpp"
|
||||
#include "boost/mpl/if.hpp"
|
||||
#include "boost/mpl/size_t.hpp"
|
||||
#include "boost/mpl/aux_/msvc_eti_base.hpp"
|
||||
@@ -195,7 +195,7 @@ struct value_accessor_generator {
|
||||
BOOST_STATIC_CONSTANT(std::size_t, dimensionality = NumDims::value);
|
||||
|
||||
typedef typename
|
||||
mpl::eval_if_c<(dimensionality == 1),
|
||||
mpl::apply_if_c<(dimensionality == 1),
|
||||
choose_value_accessor_one<T>,
|
||||
choose_value_accessor_n<T,dimensionality>
|
||||
>::type type;
|
||||
|
||||
@@ -150,10 +150,10 @@ namespace multi_array {
|
||||
|
||||
private:
|
||||
static index from_start()
|
||||
{ return (std::numeric_limits<index>::min)(); }
|
||||
{ return std::numeric_limits<index>::min(); }
|
||||
|
||||
static index to_end()
|
||||
{ return (std::numeric_limits<index>::max)(); }
|
||||
{ return std::numeric_limits<index>::max(); }
|
||||
public:
|
||||
index start_, finish_, stride_;
|
||||
bool degenerate_;
|
||||
|
||||
@@ -71,12 +71,14 @@ public:
|
||||
// make const_multi_array_ref a friend of itself
|
||||
template <typename,std::size_t,typename>
|
||||
friend class const_multi_array_ref;
|
||||
|
||||
// template <typename From, typename To> // needed for enable_if_convertible tests
|
||||
// friend class boost::detail::is_convertible_basic_impl;
|
||||
#endif
|
||||
|
||||
// This ensures that const_multi_array_ref types with different TPtr
|
||||
// types can convert to each other
|
||||
template <typename OPtr>
|
||||
const_multi_array_ref(const const_multi_array_ref<T,NumDims,OPtr>& other)
|
||||
const_multi_array_ref(const const_multi_array_ref<T,NumDims,
|
||||
OPtr>& other)
|
||||
: base_(other.base_), storage_(other.storage_),
|
||||
extent_list_(other.extent_list_),
|
||||
stride_list_(other.stride_list_),
|
||||
@@ -301,45 +303,44 @@ public:
|
||||
return !(*this < rhs);
|
||||
}
|
||||
|
||||
protected:
|
||||
// This is only supplied to support multi_array's default constructor
|
||||
explicit const_multi_array_ref(TPtr base) :
|
||||
base_(base), storage_(c_storage_order()) {
|
||||
index_base_list_.assign(0);
|
||||
boost::array<size_type,NumDims> filler;
|
||||
filler.assign(0);
|
||||
init_multi_array_ref(filler.begin());
|
||||
}
|
||||
|
||||
|
||||
// This ensures that const_multi_array_ref types with different TPtr
|
||||
// types can convert to each other
|
||||
#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
protected:
|
||||
#else
|
||||
public:
|
||||
#endif
|
||||
|
||||
typedef boost::array<size_type,NumDims> size_list;
|
||||
typedef boost::array<index,NumDims> index_list;
|
||||
|
||||
// This is used by multi_array, which is a subclass of this
|
||||
void set_base_ptr(TPtr new_base) { base_ = new_base; }
|
||||
|
||||
template <typename OPtr>
|
||||
const_multi_array_ref(
|
||||
const detail::multi_array::const_sub_array<T,NumDims,OPtr>& rhs
|
||||
)
|
||||
: base_(0), // playing it "safe"; so we learn of errors
|
||||
storage_(c_storage_order()),
|
||||
origin_offset_(0), directional_offset_(0),
|
||||
num_elements_(rhs.num_elements())
|
||||
{
|
||||
using boost::copy_n;
|
||||
copy_n(rhs.shape(),rhs.num_dimensions(),extent_list_.begin());
|
||||
copy_n(rhs.strides(),rhs.num_dimensions(),stride_list_.begin());
|
||||
copy_n(rhs.index_bases(),rhs.num_dimensions(),index_base_list_.begin());
|
||||
}
|
||||
|
||||
// This constructor supports multi_array's default constructor
|
||||
// and constructors from multi_array_ref, subarray, and array_view
|
||||
explicit
|
||||
const_multi_array_ref(TPtr base,
|
||||
const storage_order_type& so,
|
||||
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
|
||||
// private data to zeroed lists.
|
||||
if(index_bases) {
|
||||
boost::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);
|
||||
} else {
|
||||
boost::array<index,NumDims> extent_list;
|
||||
extent_list.assign(0);
|
||||
init_multi_array_ref(extent_list.begin());
|
||||
}
|
||||
}
|
||||
|
||||
typedef boost::array<size_type,NumDims> size_list;
|
||||
typedef boost::array<index,NumDims> index_list;
|
||||
|
||||
TPtr base_;
|
||||
storage_order_type storage_;
|
||||
@@ -375,12 +376,6 @@ private:
|
||||
}
|
||||
|
||||
|
||||
#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
protected:
|
||||
#else
|
||||
public:
|
||||
#endif
|
||||
// RG - move me!
|
||||
template <class InputIterator>
|
||||
void init_multi_array_ref(InputIterator extents_iter) {
|
||||
boost::function_requires<InputIteratorConcept<InputIterator> >();
|
||||
@@ -390,7 +385,9 @@ public:
|
||||
// Calculate the array size
|
||||
num_elements_ = std::accumulate(extent_list_.begin(),extent_list_.end(),
|
||||
1,std::multiplies<index>());
|
||||
|
||||
#if 0
|
||||
assert(num_elements_ != 0);
|
||||
#endif
|
||||
this->compute_strides(stride_list_,extent_list_,storage_);
|
||||
|
||||
origin_offset_ =
|
||||
@@ -421,9 +418,7 @@ public:
|
||||
typedef typename super_type::index index;
|
||||
typedef typename super_type::extent_range extent_range;
|
||||
|
||||
typedef typename super_type::storage_order_type storage_order_type;
|
||||
typedef typename super_type::index_list index_list;
|
||||
typedef typename super_type::size_list size_list;
|
||||
|
||||
|
||||
template <std::size_t NDims>
|
||||
struct const_array_view {
|
||||
@@ -464,6 +459,10 @@ public:
|
||||
const general_storage_order<NumDims>& so) :
|
||||
super_type(base,ranges,so) { }
|
||||
|
||||
template <typename OPtr>
|
||||
multi_array_ref(const detail::multi_array::
|
||||
const_sub_array<T,NumDims,OPtr>& rhs)
|
||||
: super_type(rhs) {}
|
||||
|
||||
// Assignment from other ConstMultiArray types.
|
||||
template <typename ConstMultiArray>
|
||||
@@ -547,7 +546,7 @@ public:
|
||||
this->index_bases());
|
||||
}
|
||||
|
||||
// rbegin() and rend() written naively to thwart MSVC ICE.
|
||||
// RG - rbegin() and rend() written naively to thwart MSVC ICE.
|
||||
reverse_iterator rbegin() {
|
||||
reverse_iterator ri(end());
|
||||
return ri;
|
||||
@@ -609,11 +608,10 @@ public:
|
||||
|
||||
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) { }
|
||||
explicit multi_array_ref(T* base) :
|
||||
super_type(base) {
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -194,6 +194,44 @@ private:
|
||||
const_sub_array& operator=(const const_sub_array&);
|
||||
};
|
||||
|
||||
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
//
|
||||
// Compilers that don't support partial ordering may need help to
|
||||
// disambiguate multi_array's templated constructors. Even vc6/7 are
|
||||
// capable of some limited SFINAE, so we take the most-general version
|
||||
// out of the overload set with disable_non_sub_array.
|
||||
//
|
||||
template <typename T, std::size_t NumDims, typename TPtr>
|
||||
char is_sub_array_help(const_sub_array<T,NumDims,TPtr>&);
|
||||
|
||||
char ( &is_sub_array_help(...) )[2];
|
||||
|
||||
template <class T>
|
||||
struct is_sub_array
|
||||
{
|
||||
static T x;
|
||||
BOOST_STATIC_CONSTANT(bool, value = sizeof((is_sub_array_help)(x)) == 1);
|
||||
};
|
||||
|
||||
template <bool sub_array = false>
|
||||
struct disable_non_sub_array_impl
|
||||
{
|
||||
// forming a pointer to a reference triggers SFINAE
|
||||
typedef int& type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct disable_non_sub_array_impl<true>
|
||||
{
|
||||
typedef int type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct disable_non_sub_array
|
||||
{
|
||||
typedef typename disable_non_sub_array_impl<is_sub_array<T>::value>::type type;
|
||||
};
|
||||
#endif
|
||||
|
||||
//
|
||||
// sub_array
|
||||
|
||||
27
test/Jamfile
27
test/Jamfile
@@ -33,19 +33,18 @@ test-suite multi_array
|
||||
[ compile-fail fail_ref_cview2.cpp ]
|
||||
[ compile-fail fail_ref_cview3.cpp ]
|
||||
|
||||
[ run constructors.cpp ]
|
||||
[ run access.cpp ]
|
||||
[ run compare.cpp ]
|
||||
[ run iterators.cpp ]
|
||||
[ run slice.cpp ]
|
||||
[ run assign.cpp ]
|
||||
[ run assign_to_array.cpp ]
|
||||
[ run index_bases.cpp ]
|
||||
[ run storage_order.cpp ]
|
||||
[ run reshape.cpp ]
|
||||
[ run range1.cpp ]
|
||||
[ run idxgen1.cpp ]
|
||||
[ run stl_interaction.cpp ]
|
||||
[ run resize.cpp ]
|
||||
[ run constructors.cpp <lib>../../test/build/boost_test_exec_monitor ]
|
||||
[ run access.cpp <lib>../../test/build/boost_test_exec_monitor ]
|
||||
[ run compare.cpp <lib>../../test/build/boost_test_exec_monitor ]
|
||||
[ run iterators.cpp <lib>../../test/build/boost_test_exec_monitor ]
|
||||
[ run slice.cpp <lib>../../test/build/boost_test_exec_monitor ]
|
||||
[ run assign.cpp <lib>../../test/build/boost_test_exec_monitor ]
|
||||
[ run index_bases.cpp <lib>../../test/build/boost_test_exec_monitor ]
|
||||
[ run storage_order.cpp <lib>../../test/build/boost_test_exec_monitor ]
|
||||
[ run reshape.cpp <lib>../../test/build/boost_test_exec_monitor ]
|
||||
[ run range1.cpp <lib>../../test/build/boost_test_exec_monitor ]
|
||||
[ run idxgen1.cpp <lib>../../test/build/boost_test_exec_monitor ]
|
||||
[ run stl_interaction.cpp <lib>../../test/build/boost_test_exec_monitor ]
|
||||
[ run resize.cpp <lib>../../test/build/boost_test_exec_monitor ]
|
||||
[ compile concept_checks.cpp ]
|
||||
;
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
# Copyright David Abrahams 2003. Permission to copy, use,
|
||||
# modify, sell and distribute this software is granted provided this
|
||||
# copyright notice appears in all copies. This software is provided
|
||||
# "as is" without express or implied warranty, and with no claim as
|
||||
# to its suitability for any purpose.
|
||||
|
||||
test-suite multi_array
|
||||
:
|
||||
[ compile-fail fail_cbracket.cpp ]
|
||||
[ compile-fail fail_cdata.cpp ]
|
||||
[ compile-fail fail_citerator.cpp ]
|
||||
[ compile-fail fail_cparen.cpp ]
|
||||
[ compile-fail fail_criterator.cpp ]
|
||||
[ compile-fail fail_csubarray.cpp ]
|
||||
[ compile-fail fail_csubarray2.cpp ]
|
||||
[ compile-fail fail_csubarray3.cpp ]
|
||||
[ compile-fail fail_cview.cpp ]
|
||||
[ compile-fail fail_cview2.cpp ]
|
||||
[ compile-fail fail_cview3.cpp ]
|
||||
[ compile-fail fail_ref_cbracket.cpp ]
|
||||
[ compile-fail fail_ref_cdata.cpp ]
|
||||
[ compile-fail fail_ref_citerator.cpp ]
|
||||
[ compile-fail fail_ref_cparen.cpp ]
|
||||
[ compile-fail fail_ref_criterator.cpp ]
|
||||
[ compile-fail fail_ref_csubarray.cpp ]
|
||||
[ compile-fail fail_ref_csubarray2.cpp ]
|
||||
[ compile-fail fail_ref_csubarray3.cpp ]
|
||||
[ compile-fail fail_ref_cview.cpp ]
|
||||
[ compile-fail fail_ref_cview2.cpp ]
|
||||
[ compile-fail fail_ref_cview3.cpp ]
|
||||
|
||||
[ run constructors.cpp ../../test/build//boost_test_exec_monitor ]
|
||||
[ run access.cpp ../../test/build//boost_test_exec_monitor ]
|
||||
[ run compare.cpp ../../test/build//boost_test_exec_monitor ]
|
||||
[ run iterators.cpp ../../test/build//boost_test_exec_monitor ]
|
||||
[ run slice.cpp ../../test/build//boost_test_exec_monitor ]
|
||||
[ run assign.cpp ../../test/build//boost_test_exec_monitor ]
|
||||
[ run assign_to_array.cpp ../../test/build//boost_test_exec_monitor ]
|
||||
[ run index_bases.cpp ../../test/build//boost_test_exec_monitor ]
|
||||
[ run storage_order.cpp ../../test/build//boost_test_exec_monitor ]
|
||||
[ run reshape.cpp ../../test/build//boost_test_exec_monitor ]
|
||||
[ run range1.cpp ../../test/build//boost_test_exec_monitor ]
|
||||
[ run idxgen1.cpp ../../test/build//boost_test_exec_monitor ]
|
||||
[ run stl_interaction.cpp ../../test/build//boost_test_exec_monitor ]
|
||||
[ run resize.cpp ../../test/build//boost_test_exec_monitor ]
|
||||
[ compile concept_checks.cpp ]
|
||||
;
|
||||
@@ -1,60 +0,0 @@
|
||||
// Copyright 2002 The Trustees of Indiana University.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Boost.MultiArray Library
|
||||
// Authors: Ronald Garcia
|
||||
// Jeremy Siek
|
||||
// Andrew Lumsdaine
|
||||
// See http://www.boost.org/libs/multi_array for documentation.
|
||||
|
||||
//
|
||||
// assign_to_array.cpp - multi_array should be constructible from any other
|
||||
// array type in the library.
|
||||
//
|
||||
//
|
||||
#include "generative_tests.hpp"
|
||||
#include "boost/array.hpp"
|
||||
#include "boost/multi_array.hpp"
|
||||
#include "boost/cstdlib.hpp"
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
bool equal(const int& a, const int& b)
|
||||
{
|
||||
return a == b;
|
||||
}
|
||||
|
||||
template <typename ArrayA, typename ArrayB>
|
||||
bool equal(const ArrayA& A, const ArrayB& B)
|
||||
{
|
||||
typename ArrayA::const_iterator ia;
|
||||
typename ArrayB::const_iterator ib = B.begin();
|
||||
for (ia = A.begin(); ia != A.end(); ++ia, ++ib)
|
||||
if (!equal(*ia, *ib))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template <typename Array>
|
||||
void access(Array& A, const mutable_array_tag&) {
|
||||
|
||||
assign(A);
|
||||
access(A,const_array_tag());
|
||||
}
|
||||
|
||||
template <typename Array>
|
||||
void access(Array& A, const const_array_tag&) {
|
||||
typedef boost::multi_array<int,3> array3;
|
||||
array3 acopy(A);
|
||||
BOOST_TEST(equal(acopy,A));
|
||||
++tests_run;
|
||||
}
|
||||
|
||||
|
||||
int test_main(int,char*[]) {
|
||||
return run_generative_tests();
|
||||
}
|
||||
@@ -14,7 +14,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <list>
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
//
|
||||
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
@@ -141,10 +141,10 @@ typedef std::size_t size_type;
|
||||
|
||||
private:
|
||||
static Index from_start()
|
||||
{ return (std::numeric_limits<Index>::min)(); }
|
||||
{ return std::numeric_limits<Index>::min(); }
|
||||
|
||||
static Index to_end()
|
||||
{ return (std::numeric_limits<Index>::max)(); }
|
||||
{ return std::numeric_limits<Index>::max(); }
|
||||
public:
|
||||
Index start_, finish_, stride_;
|
||||
bool degenerate_;
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/array.hpp"
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/array.hpp"
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
|
||||
int test_main(int,char*[]) {
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/array.hpp"
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
|
||||
int test_main(int,char*[]) {
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/array.hpp"
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/array.hpp"
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/array.hpp"
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/array.hpp"
|
||||
#include "boost/type.hpp"
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/array.hpp"
|
||||
#include "boost/type.hpp"
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/array.hpp"
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/array.hpp"
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
|
||||
int test_main(int,char*[]) {
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/array.hpp"
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
|
||||
int test_main(int,char*[]) {
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/array.hpp"
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/array.hpp"
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/array.hpp"
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/array.hpp"
|
||||
#include "boost/type.hpp"
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/array.hpp"
|
||||
#include "boost/type.hpp"
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/array.hpp"
|
||||
#include "boost/type.hpp"
|
||||
|
||||
@@ -1,18 +1,6 @@
|
||||
#ifndef GENERATIVE_TESTS_RG072001_HPP
|
||||
#define GENERATIVE_TESTS_RG072001_HPP
|
||||
|
||||
// Copyright 2002 The Trustees of Indiana University.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Boost.MultiArray Library
|
||||
// Authors: Ronald Garcia
|
||||
// Jeremy Siek
|
||||
// Andrew Lumsdaine
|
||||
// See http://www.boost.org/libs/multi_array for documentation.
|
||||
|
||||
//
|
||||
// generative-tests.hpp - Framework for running tests on all the types
|
||||
// of multi_array
|
||||
@@ -47,7 +35,8 @@
|
||||
//
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
#include "boost/multi_array/index_gen.hpp"
|
||||
#include "boost/multi_array/index_range.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/array.hpp"
|
||||
#include <cstddef>
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/array.hpp"
|
||||
#include <vector>
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
#define MULTIARRAY_TEST_ASSIGN
|
||||
#include "generative_tests.hpp"
|
||||
#include "boost/concept_check.hpp" // for ignore_unused_variable_warning
|
||||
#include "boost/mpl/if.hpp"
|
||||
#include "boost/type_traits/is_same.hpp"
|
||||
|
||||
// iterator-test-specific code
|
||||
|
||||
@@ -66,14 +64,46 @@ struct ittraits_mutable {
|
||||
riterator1;
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// choose ittraits begins
|
||||
//
|
||||
|
||||
struct choose_ittraits_const {
|
||||
template <typename Array>
|
||||
struct bind {
|
||||
typedef ittraits_const<Array> type;
|
||||
};
|
||||
};
|
||||
|
||||
struct choose_ittraits_mutable {
|
||||
template <typename Array>
|
||||
struct bind {
|
||||
typedef ittraits_mutable<Array> type;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
template <typename ConstnessTag>
|
||||
struct ittraits_gen_helper {
|
||||
typedef choose_ittraits_mutable choice;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ittraits_gen_helper<const_array_tag> {
|
||||
typedef choose_ittraits_const choice;
|
||||
};
|
||||
|
||||
// Meta-program chooses ittraits implementation.
|
||||
template <typename Array, typename ConstTag>
|
||||
struct ittraits_generator :
|
||||
boost::mpl::if_< boost::is_same<ConstTag,const_array_tag>,
|
||||
ittraits_const<Array>,
|
||||
ittraits_mutable<Array> >
|
||||
{};
|
||||
struct ittraits_generator {
|
||||
private:
|
||||
typedef typename ittraits_gen_helper<ConstTag>::choice Choice;
|
||||
public:
|
||||
typedef typename Choice::template bind<Array>::type type;
|
||||
};
|
||||
|
||||
//
|
||||
// choose ittraits ends
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
template <typename Array>
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
#include "boost/multi_array/index_range.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/array.hpp"
|
||||
#include <cstddef>
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/array.hpp"
|
||||
#include "boost/type.hpp"
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// resize.cpp - Test of resizing multi_arrays
|
||||
//
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#include "boost/test/test_tools.hpp"
|
||||
#include "boost/multi_array.hpp"
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
#include "generative_tests.hpp"
|
||||
#include "boost/array.hpp"
|
||||
#include "boost/mpl/if.hpp"
|
||||
#include "boost/type_traits/is_same.hpp"
|
||||
|
||||
template <typename Array>
|
||||
struct view_traits_mutable {
|
||||
@@ -41,14 +39,46 @@ struct view_traits_const {
|
||||
};
|
||||
|
||||
|
||||
// Meta-program selects the proper view_traits implementation.
|
||||
template <typename Array, typename ConstTag>
|
||||
struct view_traits_generator :
|
||||
boost::mpl::if_< boost::is_same<ConstTag,const_array_tag>,
|
||||
view_traits_const<Array>,
|
||||
view_traits_mutable<Array> >
|
||||
{};
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// choose view_traits begins
|
||||
//
|
||||
|
||||
struct choose_view_traits_const {
|
||||
template <typename Array>
|
||||
struct bind {
|
||||
typedef view_traits_const<Array> type;
|
||||
};
|
||||
};
|
||||
|
||||
struct choose_view_traits_mutable {
|
||||
template <typename Array>
|
||||
struct bind {
|
||||
typedef view_traits_mutable<Array> type;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
template <typename ConstnessTag>
|
||||
struct view_traits_gen_helper {
|
||||
typedef choose_view_traits_mutable choice;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct view_traits_gen_helper<const_array_tag> {
|
||||
typedef choose_view_traits_const choice;
|
||||
};
|
||||
|
||||
template <typename Array, typename ConstTag>
|
||||
struct view_traits_generator {
|
||||
private:
|
||||
typedef typename view_traits_gen_helper<ConstTag>::choice Choice;
|
||||
public:
|
||||
typedef typename Choice::template bind<Array>::type type;
|
||||
};
|
||||
|
||||
//
|
||||
// choose view_traits ends
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <typename Array, typename ViewTraits>
|
||||
void test_views(Array& A, const ViewTraits&) {
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
// stl_interaction.cpp - Make sure multi_arrays work with STL containers.
|
||||
//
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/array.hpp"
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
// test out my new storage_order stuff
|
||||
//
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/multi_array/storage_order.hpp"
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
#include "boost/multi_array.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include "boost/test/test_tools.hpp"
|
||||
|
||||
#include "boost/array.hpp"
|
||||
#include <vector>
|
||||
|
||||
Reference in New Issue
Block a user