Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62611 - in trunk: boost boost/multi_array libs/concept_check libs/multi_array/doc/xml libs/multi_array/example libs/multi_array/test
From: jewillco_at_[hidden]
Date: 2010-06-08 19:28:24


Author: jewillco
Date: 2010-06-08 19:28:23 EDT (Tue, 08 Jun 2010)
New Revision: 62611
URL: http://svn.boost.org/trac/boost/changeset/62611

Log:
Moved Collection concept into Boost.ConceptCheck; moved other MultiArray concepts into boost::multi_array_concepts and documented them in reference.xml (do not know how to rebuild HTML from that); fixes #4032
Text files modified:
   trunk/boost/concept_check.hpp | 38 ++++++++++++++++++++++++++++++++++++
   trunk/boost/multi_array/collection_concept.hpp | 42 ++-------------------------------------
   trunk/boost/multi_array/concept_checks.hpp | 27 +++++++++++++++++--------
   trunk/boost/multi_array/multi_array_ref.hpp | 20 +++++++++---------
   trunk/boost/multi_array/subarray.hpp | 8 +++---
   trunk/boost/multi_array/view.hpp | 10 ++++----
   trunk/libs/concept_check/reference.htm | 4 +++
   trunk/libs/multi_array/doc/xml/MultiArray.xml | 8 +++++++
   trunk/libs/multi_array/example/resize_from_other.cpp | 2
   trunk/libs/multi_array/test/concept_checks.cpp | 22 ++++++++++----------
   10 files changed, 102 insertions(+), 79 deletions(-)

Modified: trunk/boost/concept_check.hpp
==============================================================================
--- trunk/boost/concept_check.hpp (original)
+++ trunk/boost/concept_check.hpp 2010-06-08 19:28:23 EDT (Tue, 08 Jun 2010)
@@ -1,5 +1,7 @@
 //
 // (C) Copyright Jeremy Siek 2000.
+// Copyright 2002 The Trustees of Indiana University.
+//
 // Distributed under 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)
@@ -999,6 +1001,42 @@
 
   // HashedAssociativeContainer
 
+ BOOST_concept(Collection,(C))
+ {
+ BOOST_CONCEPT_USAGE(Collection)
+ {
+ boost::function_requires<boost::InputIteratorConcept<iterator> >();
+ boost::function_requires<boost::InputIteratorConcept<const_iterator> >();
+ boost::function_requires<boost::CopyConstructibleConcept<value_type> >();
+ const_constraints(c);
+ i = c.begin();
+ i = c.end();
+ c.swap(c);
+ }
+
+ void const_constraints(const C& c) {
+ ci = c.begin();
+ ci = c.end();
+ n = c.size();
+ b = c.empty();
+ }
+
+ private:
+ typedef typename C::value_type value_type;
+ typedef typename C::iterator iterator;
+ typedef typename C::const_iterator const_iterator;
+ typedef typename C::reference reference;
+ typedef typename C::const_reference const_reference;
+ // typedef typename C::pointer pointer;
+ typedef typename C::difference_type difference_type;
+ typedef typename C::size_type size_type;
+
+ C c;
+ bool b;
+ iterator i;
+ const_iterator ci;
+ size_type n;
+ };
 } // namespace boost
 
 # include <boost/concept/detail/concept_undef.hpp>

Modified: trunk/boost/multi_array/collection_concept.hpp
==============================================================================
--- trunk/boost/multi_array/collection_concept.hpp (original)
+++ trunk/boost/multi_array/collection_concept.hpp 2010-06-08 19:28:23 EDT (Tue, 08 Jun 2010)
@@ -17,46 +17,10 @@
 
 namespace boost {
 namespace detail {
-namespace multi_array {
-
- //===========================================================================
- // Collection Concept
-
- template <class Collection>
- struct CollectionConcept
- {
- typedef typename Collection::value_type value_type;
- typedef typename Collection::iterator iterator;
- typedef typename Collection::const_iterator const_iterator;
- typedef typename Collection::reference reference;
- typedef typename Collection::const_reference const_reference;
- // typedef typename Collection::pointer pointer;
- typedef typename Collection::difference_type difference_type;
- typedef typename Collection::size_type size_type;
-
- void constraints() {
- boost::function_requires<boost::InputIteratorConcept<iterator> >();
- boost::function_requires<boost::InputIteratorConcept<const_iterator> >();
- boost::function_requires<boost::CopyConstructibleConcept<value_type> >();
- const_constraints(c);
- i = c.begin();
- i = c.end();
- c.swap(c);
- }
- void const_constraints(const Collection& c) {
- ci = c.begin();
- ci = c.end();
- n = c.size();
- b = c.empty();
- }
- Collection c;
- bool b;
- iterator i;
- const_iterator ci;
- size_type n;
- };
-
+namespace multi_array { // Old location for this
+ using boost::CollectionConcept;
 }
 }
+
 }
 #endif // COLLECTION_CONCEPT_RG103101_HPP

Modified: trunk/boost/multi_array/concept_checks.hpp
==============================================================================
--- trunk/boost/multi_array/concept_checks.hpp (original)
+++ trunk/boost/multi_array/concept_checks.hpp 2010-06-08 19:28:23 EDT (Tue, 08 Jun 2010)
@@ -22,9 +22,9 @@
 #include "boost/iterator/iterator_concepts.hpp"
 
 namespace boost {
-namespace detail {
-namespace multi_array {
+namespace multi_array_concepts {
 
+namespace detail {
   //
   // idgen_helper -
   // This is a helper for generating index_gen instantiations with
@@ -56,6 +56,8 @@
     }
   };
 
+} // namespace detail
+
 
   template <typename Array, std::size_t NumDims >
   struct ConstMultiArrayConcept
@@ -70,10 +72,10 @@
       // RG - a( CollectionArchetype) when available...
       a[ id ];
       // Test slicing, keeping only the first dimension, losing the rest
- idgen_helper<NumDims-1>::call(a,idgen[range],id);
+ detail::idgen_helper<NumDims-1>::call(a,idgen[range],id);
 
       // Test slicing, keeping all dimensions.
- idgen_helper<NumDims-1>::call(a,idgen[range],range);
+ detail::idgen_helper<NumDims-1>::call(a,idgen[range],range);
 
       st = a.size();
       st = a.num_dimensions();
@@ -134,10 +136,10 @@
       value_type vt = a[ id ];
 
       // Test slicing, keeping only the first dimension, losing the rest
- idgen_helper<NumDims-1>::call(a,idgen[range],id);
+ detail::idgen_helper<NumDims-1>::call(a,idgen[range],id);
 
       // Test slicing, keeping all dimensions.
- idgen_helper<NumDims-1>::call(a,idgen[range],range);
+ detail::idgen_helper<NumDims-1>::call(a,idgen[range],range);
 
       st = a.size();
       st = a.num_dimensions();
@@ -158,10 +160,10 @@
       // value_type vt = a[ id ];
 
       // Test slicing, keeping only the first dimension, losing the rest
- idgen_helper<NumDims-1>::call(a,idgen[range],id);
+ detail::idgen_helper<NumDims-1>::call(a,idgen[range],id);
 
       // Test slicing, keeping all dimensions.
- idgen_helper<NumDims-1>::call(a,idgen[range],range);
+ detail::idgen_helper<NumDims-1>::call(a,idgen[range],range);
 
       st = a.size();
       st = a.num_dimensions();
@@ -208,7 +210,14 @@
 
 
 } // namespace multi_array
-} // namespace detail
+
+namespace detail {
+ namespace multi_array { // Old locations for these
+ using boost::multi_array_concepts::ConstMultiArrayConcept;
+ using boost::multi_array_concepts::MutableMultiArrayConcept;
+ }
+}
+
 } // namespace boost
 
 

Modified: trunk/boost/multi_array/multi_array_ref.hpp
==============================================================================
--- trunk/boost/multi_array/multi_array_ref.hpp (original)
+++ trunk/boost/multi_array/multi_array_ref.hpp 2010-06-08 19:28:23 EDT (Tue, 08 Jun 2010)
@@ -89,7 +89,7 @@
   explicit const_multi_array_ref(TPtr base, const ExtentList& extents) :
     base_(base), storage_(c_storage_order()) {
     boost::function_requires<
- detail::multi_array::CollectionConcept<ExtentList> >();
+ CollectionConcept<ExtentList> >();
 
     index_base_list_.assign(0);
     init_multi_array_ref(extents.begin());
@@ -100,7 +100,7 @@
                        const general_storage_order<NumDims>& so) :
     base_(base), storage_(so) {
     boost::function_requires<
- detail::multi_array::CollectionConcept<ExtentList> >();
+ CollectionConcept<ExtentList> >();
 
     index_base_list_.assign(0);
     init_multi_array_ref(extents.begin());
@@ -145,7 +145,7 @@
 #endif // BOOST_NO_SFINAE
   reindex(const BaseList& values) {
     boost::function_requires<
- detail::multi_array::CollectionConcept<BaseList> >();
+ CollectionConcept<BaseList> >();
     boost::detail::multi_array::
       copy_n(values.begin(),num_dimensions(),index_base_list_.begin());
     origin_offset_ =
@@ -163,7 +163,7 @@
   template <typename SizeList>
   void reshape(const SizeList& extents) {
     boost::function_requires<
- detail::multi_array::CollectionConcept<SizeList> >();
+ CollectionConcept<SizeList> >();
     BOOST_ASSERT(num_elements_ ==
                  std::accumulate(extents.begin(),extents.end(),
                                  size_type(1),std::multiplies<size_type>()));
@@ -210,7 +210,7 @@
   template <typename IndexList>
   const element& operator()(IndexList indices) const {
     boost::function_requires<
- detail::multi_array::CollectionConcept<IndexList> >();
+ CollectionConcept<IndexList> >();
     return super_type::access_element(boost::type<const element&>(),
                                       indices,origin(),
                                       shape(),strides(),index_bases());
@@ -448,7 +448,7 @@
   explicit multi_array_ref(T* base, const ExtentList& extents) :
     super_type(base,extents) {
     boost::function_requires<
- detail::multi_array::CollectionConcept<ExtentList> >();
+ CollectionConcept<ExtentList> >();
   }
 
   template <class ExtentList>
@@ -456,7 +456,7 @@
                            const general_storage_order<NumDims>& so) :
     super_type(base,extents,so) {
     boost::function_requires<
- detail::multi_array::CollectionConcept<ExtentList> >();
+ CollectionConcept<ExtentList> >();
   }
 
 
@@ -478,7 +478,7 @@
   template <typename ConstMultiArray>
   multi_array_ref& operator=(const ConstMultiArray& other) {
     function_requires<
- detail::multi_array::
+ multi_array_concepts::
       ConstMultiArrayConcept<ConstMultiArray,NumDims> >();
 
     // make sure the dimensions agree
@@ -511,7 +511,7 @@
   template <class IndexList>
   element& operator()(const IndexList& indices) {
     boost::function_requires<
- detail::multi_array::CollectionConcept<IndexList> >();
+ CollectionConcept<IndexList> >();
     return super_type::access_element(boost::type<element&>(),
                                       indices,origin(),
                                       this->shape(),this->strides(),
@@ -578,7 +578,7 @@
   template <class IndexList>
   const element& operator()(const IndexList& indices) const {
     boost::function_requires<
- detail::multi_array::CollectionConcept<IndexList> >();
+ CollectionConcept<IndexList> >();
     return super_type::operator()(indices);
   }
 

Modified: trunk/boost/multi_array/subarray.hpp
==============================================================================
--- trunk/boost/multi_array/subarray.hpp (original)
+++ trunk/boost/multi_array/subarray.hpp 2010-06-08 19:28:23 EDT (Tue, 08 Jun 2010)
@@ -80,7 +80,7 @@
   template <typename IndexList>
   const element& operator()(const IndexList& indices) const {
     boost::function_requires<
- detail::multi_array::CollectionConcept<IndexList> >();
+ CollectionConcept<IndexList> >();
     return super_type::access_element(boost::type<const element&>(),
                                       indices,origin(),
                                       shape(),strides(),index_bases());
@@ -231,7 +231,7 @@
   // Assignment from other ConstMultiArray types.
   template <typename ConstMultiArray>
   sub_array& operator=(const ConstMultiArray& other) {
- function_requires< boost::detail::multi_array::ConstMultiArrayConcept<
+ function_requires< boost::multi_array_concepts::ConstMultiArrayConcept<
         ConstMultiArray, NumDims> >();
 
     // make sure the dimensions agree
@@ -288,7 +288,7 @@
   template <class IndexList>
   element& operator()(const IndexList& indices) {
     boost::function_requires<
- detail::multi_array::CollectionConcept<IndexList> >();
+ CollectionConcept<IndexList> >();
     return super_type::access_element(boost::type<element&>(),
                                       indices,origin(),
                                       this->shape(),this->strides(),
@@ -323,7 +323,7 @@
   template <class IndexList>
   const element& operator()(const IndexList& indices) const {
     boost::function_requires<
- detail::multi_array::CollectionConcept<IndexList> >();
+ CollectionConcept<IndexList> >();
     return super_type::operator()(indices);
   }
 

Modified: trunk/boost/multi_array/view.hpp
==============================================================================
--- trunk/boost/multi_array/view.hpp (original)
+++ trunk/boost/multi_array/view.hpp 2010-06-08 19:28:23 EDT (Tue, 08 Jun 2010)
@@ -81,7 +81,7 @@
 #endif
   reindex(const BaseList& values) {
     boost::function_requires<
- detail::multi_array::CollectionConcept<BaseList> >();
+ CollectionConcept<BaseList> >();
     boost::detail::multi_array::
       copy_n(values.begin(),num_dimensions(),index_base_list_.begin());
     origin_offset_ =
@@ -119,7 +119,7 @@
   template <typename IndexList>
   const element& operator()(IndexList indices) const {
     boost::function_requires<
- detail::multi_array::CollectionConcept<IndexList> >();
+ CollectionConcept<IndexList> >();
     return super_type::access_element(boost::type<const element&>(),
                                       indices,origin(),
                                       shape(),strides(),index_bases());
@@ -297,7 +297,7 @@
   template <typename ConstMultiArray>
   multi_array_view& operator=(const ConstMultiArray& other) {
     function_requires<
- boost::detail::multi_array::
+ boost::multi_array_concepts::
       ConstMultiArrayConcept<ConstMultiArray,NumDims> >();
 
     // make sure the dimensions agree
@@ -328,7 +328,7 @@
   template <class IndexList>
   element& operator()(const IndexList& indices) {
     boost::function_requires<
- detail::multi_array::CollectionConcept<IndexList> >();
+ CollectionConcept<IndexList> >();
     return super_type::access_element(boost::type<element&>(),
                                       indices,origin(),
                                       this->shape(),this->strides(),
@@ -392,7 +392,7 @@
   template <class IndexList>
   const element& operator()(const IndexList& indices) const {
     boost::function_requires<
- detail::multi_array::CollectionConcept<IndexList> >();
+ CollectionConcept<IndexList> >();
     return super_type::operator()(indices);
   }
 

Modified: trunk/libs/concept_check/reference.htm
==============================================================================
--- trunk/libs/concept_check/reference.htm (original)
+++ trunk/libs/concept_check/reference.htm 2010-06-08 19:28:23 EDT (Tue, 08 Jun 2010)
@@ -279,6 +279,10 @@
 template &lt;class C&gt;
 struct <a href=
 "http://www.sgi.com/tech/stl/SortedAssociativeContainer.html">SortedAssociativeContainer</a>;
+
+template &lt;class C&gt;
+struct <a href=
+"../utility/Collection.html">Collection</a>;
 </pre>
 
   <h3><a name="basic-archetype" id="basic-archetype">Basic Archetype

Modified: trunk/libs/multi_array/doc/xml/MultiArray.xml
==============================================================================
--- trunk/libs/multi_array/doc/xml/MultiArray.xml (original)
+++ trunk/libs/multi_array/doc/xml/MultiArray.xml 2010-06-08 19:28:23 EDT (Tue, 08 Jun 2010)
@@ -110,6 +110,14 @@
 column are stored contiguously).
 </para>
 
+<para>
+Two concept checking classes for the MultiArray concepts
+(<literal>ConstMultiArrayConcept</literal> and
+<literal>MutableMultiArrayConcept</literal>) are in the namespace
+<literal>boost::multi_array_concepts</literal> in
+<literal>&lt;boost/multi_array/concept_checks.hpp&gt;</literal>.
+</para>
+
 
 <sect2><title>Notation</title>
 <para>What follows are the descriptions of symbols that will be used

Modified: trunk/libs/multi_array/example/resize_from_other.cpp
==============================================================================
--- trunk/libs/multi_array/example/resize_from_other.cpp (original)
+++ trunk/libs/multi_array/example/resize_from_other.cpp 2010-06-08 19:28:23 EDT (Tue, 08 Jun 2010)
@@ -26,7 +26,7 @@
 
   // U must be a model of MultiArray
   boost::function_requires<
- boost::detail::multi_array::ConstMultiArrayConcept<U,U::dimensionality> >();
+ boost::multi_array_concepts::ConstMultiArrayConcept<U,U::dimensionality> >();
   // U better have U::dimensionality == N
   BOOST_STATIC_ASSERT(U::dimensionality == N);
 

Modified: trunk/libs/multi_array/test/concept_checks.cpp
==============================================================================
--- trunk/libs/multi_array/test/concept_checks.cpp (original)
+++ trunk/libs/multi_array/test/concept_checks.cpp 2010-06-08 19:28:23 EDT (Tue, 08 Jun 2010)
@@ -38,28 +38,28 @@
   typedef array::const_subarray<ndims>::type const_subarray;
 
 boost::function_requires<
- boost::detail::multi_array::ConstMultiArrayConcept<array,ndims> >();
+ boost::multi_array_concepts::ConstMultiArrayConcept<array,ndims> >();
 boost::function_requires<
- boost::detail::multi_array::ConstMultiArrayConcept<array_ref,ndims> >();
+ boost::multi_array_concepts::ConstMultiArrayConcept<array_ref,ndims> >();
 boost::function_requires<
- boost::detail::multi_array::ConstMultiArrayConcept<const_array_ref,ndims> >();
+ boost::multi_array_concepts::ConstMultiArrayConcept<const_array_ref,ndims> >();
 boost::function_requires<
- boost::detail::multi_array::ConstMultiArrayConcept<array_view,ndims> >();
+ boost::multi_array_concepts::ConstMultiArrayConcept<array_view,ndims> >();
 boost::function_requires<
- boost::detail::multi_array::ConstMultiArrayConcept<const_array_view,ndims> >();
+ boost::multi_array_concepts::ConstMultiArrayConcept<const_array_view,ndims> >();
 boost::function_requires<
- boost::detail::multi_array::ConstMultiArrayConcept<subarray,ndims> >();
+ boost::multi_array_concepts::ConstMultiArrayConcept<subarray,ndims> >();
 boost::function_requires<
- boost::detail::multi_array::ConstMultiArrayConcept<const_subarray,ndims> >();
+ boost::multi_array_concepts::ConstMultiArrayConcept<const_subarray,ndims> >();
 
 boost::function_requires<
- boost::detail::multi_array::MutableMultiArrayConcept<array,ndims> >();
+ boost::multi_array_concepts::MutableMultiArrayConcept<array,ndims> >();
 boost::function_requires<
- boost::detail::multi_array::MutableMultiArrayConcept<array_ref,ndims> >();
+ boost::multi_array_concepts::MutableMultiArrayConcept<array_ref,ndims> >();
 boost::function_requires<
- boost::detail::multi_array::MutableMultiArrayConcept<array_view,ndims> >();
+ boost::multi_array_concepts::MutableMultiArrayConcept<array_view,ndims> >();
 boost::function_requires<
- boost::detail::multi_array::MutableMultiArrayConcept<subarray,ndims> >();
+ boost::multi_array_concepts::MutableMultiArrayConcept<subarray,ndims> >();
 
   return 0;
 }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk