]> git.lyx.org Git - lyx.git/blob - boost/boost/multi_array/collection_concept.hpp
update boost
[lyx.git] / boost / boost / multi_array / collection_concept.hpp
1 // Copyright (C) 2002 Ronald Garcia
2 //
3 // Permission to copy, use, sell and distribute this software is granted
4 // provided this copyright notice appears in all copies. 
5 // Permission to modify the code and to distribute modified code is granted
6 // provided this copyright notice appears in all copies, and a notice 
7 // that the code was modified is included with the copyright notice.
8 //
9 // This software is provided "as is" without express or implied warranty, 
10 // and with no claim as to its suitability for any purpose.
11 //
12
13 #ifndef COLLECTION_CONCEPT_RG103101_HPP
14 #define COLLECTION_CONCEPT_RG103101_HPP
15
16 #include "boost/concept_check.hpp"
17
18 namespace boost {
19 namespace detail {
20 namespace multi_array {
21
22   //===========================================================================
23   // Collection Concept
24
25   template <class Collection>
26   struct CollectionConcept
27   {
28     typedef typename Collection::value_type value_type;
29     typedef typename Collection::iterator iterator;
30     typedef typename Collection::const_iterator const_iterator;
31     typedef typename Collection::reference reference;
32     typedef typename Collection::const_reference const_reference;
33     // typedef typename Collection::pointer pointer;
34     typedef typename Collection::difference_type difference_type;
35     typedef typename Collection::size_type size_type;
36
37     void constraints() {
38       boost::function_requires<boost::InputIteratorConcept<iterator> >();
39       boost::function_requires<boost::InputIteratorConcept<const_iterator> >();
40       boost::function_requires<boost::CopyConstructibleConcept<value_type> >();
41       const_constraints(c);
42       i = c.begin();
43       i = c.end();
44       c.swap(c);
45     }
46     void const_constraints(const Collection& c) {
47       ci = c.begin();
48       ci = c.end();
49       n = c.size();
50       b = c.empty();
51     }
52     Collection c;
53     bool b;
54     iterator i;
55     const_iterator ci;
56     size_type n;
57   };
58
59 }
60 }
61 }
62 #endif // COLLECTION_CONCEPT_RG103101_HPP