]> git.lyx.org Git - lyx.git/blobdiff - boost/boost/multi_array/subarray.hpp
* src/MenuBackend.[Ch]: the specialMenu is now a real menu, not a
[lyx.git] / boost / boost / multi_array / subarray.hpp
index 5e2c052fba6084df11d8e029db4620516198710e..359d00e951a3eb528e6af563c06347011be6d7c2 100644 (file)
@@ -79,9 +79,11 @@ public:
   
   template <typename IndexList>
   const element& operator()(const IndexList& indices) const {
+    boost::function_requires<
+      detail::multi_array::CollectionConcept<IndexList> >();
     return super_type::access_element(boost::type<const element&>(),
-                                      origin(),
-                                      indices,strides());
+                                      indices,origin(),
+                                      shape(),strides(),index_bases());
   }
 
   // see generate_array_view in base.hpp
@@ -142,7 +144,7 @@ public:
   }
 
   const_iterator end() const {
-    return const_iterator(*index_bases()+*shape(),origin(),
+    return const_iterator(*index_bases()+(index)*shape(),origin(),
                           shape(),strides(),index_bases());
   }
 
@@ -194,44 +196,6 @@ 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
@@ -322,9 +286,12 @@ public:
 
   template <class IndexList>
   element& operator()(const IndexList& indices) {
+    boost::function_requires<
+      detail::multi_array::CollectionConcept<IndexList> >();
     return super_type::access_element(boost::type<element&>(),
-                                      origin(),
-                                      indices,this->strides());
+                                      indices,origin(),
+                                      this->shape(),this->strides(),
+                                      this->index_bases());
   }
 
   iterator begin() {
@@ -333,7 +300,7 @@ public:
   }
 
   iterator end() {
-    return iterator(*this->index_bases()+*this->shape(),origin(),
+    return iterator(*this->index_bases()+(index)*this->shape(),origin(),
                     this->shape(),this->strides(),this->index_bases());
   }
 
@@ -354,6 +321,8 @@ public:
 
   template <class IndexList>
   const element& operator()(const IndexList& indices) const {
+    boost::function_requires<
+      detail::multi_array::CollectionConcept<IndexList> >();
     return super_type::operator()(indices);
   }