source: NonGTP/Boost/boost/multi_array/collection_concept.hpp @ 857

Revision 857, 1.9 KB checked in by igarcia, 19 years ago (diff)
Line 
1// Copyright 2002 The Trustees of Indiana University.
2
3// Use, modification and distribution is subject to the Boost Software
4// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5// http://www.boost.org/LICENSE_1_0.txt)
6
7//  Boost.MultiArray Library
8//  Authors: Ronald Garcia
9//           Jeremy Siek
10//           Andrew Lumsdaine
11//  See http://www.boost.org/libs/multi_array for documentation.
12
13#ifndef COLLECTION_CONCEPT_RG103101_HPP
14#define COLLECTION_CONCEPT_RG103101_HPP
15
16#include "boost/concept_check.hpp"
17
18namespace boost {
19namespace detail {
20namespace 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
Note: See TracBrowser for help on using the repository browser.