mirror of
https://github.com/boostorg/multi_array.git
synced 2025-05-11 21:33:52 +00:00
Workarounds for vc7
[SVN r20920]
This commit is contained in:
parent
9542f4546b
commit
f39fdf871b
@ -85,15 +85,20 @@ public:
|
||||
super_type((T*)initial_base_) {
|
||||
allocate_space();
|
||||
}
|
||||
|
||||
|
||||
template <class ExtentList>
|
||||
explicit multi_array(ExtentList const& extents) :
|
||||
explicit multi_array(
|
||||
ExtentList const& extents
|
||||
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
, 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,
|
||||
const general_storage_order<NumDims>& so) :
|
||||
|
@ -61,7 +61,11 @@ namespace multi_array {
|
||||
struct ConstMultiArrayConcept
|
||||
{
|
||||
void constraints() {
|
||||
// function_requires< CopyConstructibleConcept<Array> >();
|
||||
// function_requires< CopyConstructibleConcept<Array> >();
|
||||
function_requires< boost_concepts::ForwardTraversalConcept<iterator> >();
|
||||
function_requires< boost_concepts::ReadableIteratorConcept<iterator> >();
|
||||
function_requires< boost_concepts::ForwardTraversalConcept<const_iterator> >();
|
||||
function_requires< boost_concepts::ReadableIteratorConcept<const_iterator> >();
|
||||
|
||||
// RG - a( CollectionArchetype) when available...
|
||||
a[ id ];
|
||||
@ -100,11 +104,6 @@ namespace multi_array {
|
||||
typedef typename Array::extent_gen extent_gen;
|
||||
typedef typename Array::extent_range extent_range;
|
||||
|
||||
BOOST_CLASS_REQUIRE(iterator, boost_concepts, ForwardTraversalConcept);
|
||||
BOOST_CLASS_REQUIRE(iterator, boost_concepts, ReadableIteratorConcept);
|
||||
BOOST_CLASS_REQUIRE(const_iterator, boost_concepts, ForwardTraversalConcept);
|
||||
BOOST_CLASS_REQUIRE(const_iterator, boost_concepts, ReadableIteratorConcept);
|
||||
|
||||
Array a;
|
||||
size_type st;
|
||||
const size_type* stp;
|
||||
@ -124,6 +123,12 @@ namespace multi_array {
|
||||
void constraints() {
|
||||
// function_requires< CopyConstructibleConcept<Array> >();
|
||||
|
||||
function_requires< boost_concepts::ForwardTraversalConcept<iterator> >();
|
||||
function_requires< boost_concepts::ReadableIteratorConcept<iterator> >();
|
||||
function_requires< boost_concepts::WritableIteratorConcept<iterator> >();
|
||||
function_requires< boost_concepts::ForwardTraversalConcept<const_iterator> >();
|
||||
function_requires< boost_concepts::ReadableIteratorConcept<const_iterator> >();
|
||||
|
||||
// RG - a( CollectionArchetype) when available...
|
||||
value_type vt = a[ id ];
|
||||
|
||||
@ -186,12 +191,6 @@ namespace multi_array {
|
||||
typedef typename Array::extent_gen extent_gen;
|
||||
typedef typename Array::extent_range extent_range;
|
||||
|
||||
BOOST_CLASS_REQUIRE(iterator, boost_concepts, ForwardTraversalConcept);
|
||||
BOOST_CLASS_REQUIRE(iterator, boost_concepts, ReadableIteratorConcept);
|
||||
BOOST_CLASS_REQUIRE(iterator, boost_concepts, WritableIteratorConcept);
|
||||
BOOST_CLASS_REQUIRE(const_iterator, boost_concepts, ForwardTraversalConcept);
|
||||
BOOST_CLASS_REQUIRE(const_iterator, boost_concepts, ReadableIteratorConcept);
|
||||
|
||||
Array a;
|
||||
size_type st;
|
||||
const size_type* stp;
|
||||
|
@ -194,6 +194,45 @@ 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
|
||||
: disable_non_sub_array_impl<is_sub_array<T>::value>
|
||||
{
|
||||
};
|
||||
#endif
|
||||
|
||||
//
|
||||
// sub_array
|
||||
// multi_array's proxy class to allow multiple overloads of
|
||||
|
Loading…
x
Reference in New Issue
Block a user