Vaucanson  1.4.1
container_ops.hxx
1 // container_ops.hxx: this file is part of the Vaucanson project.
2 //
3 // Vaucanson, a generic library for finite state machines.
4 //
5 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 The Vaucanson Group.
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
11 //
12 // The complete GNU General Public Licence Notice can be found as the
13 // `COPYING' file in the root directory.
14 //
15 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
16 //
17 #ifndef VCSN_TOOLS_CONTAINER_OPS_HXX
18 # define VCSN_TOOLS_CONTAINER_OPS_HXX
19 
20 # include <algorithm>
21 
24 
25 namespace vcsn
26 {
27 
28  template<typename S, typename T>
29  typename T::iterator op_begin (const Structure<S>&,
30  T& v)
31  {
32  return v.begin ();
33  }
34 
35  template<typename S, typename T>
36  typename T::iterator op_end (const Structure<S>&,
37  T& v)
38  {
39  return v.end ();
40  }
41 
42  template<typename S, typename T>
43  typename T::const_iterator op_begin_const (const Structure<S>&,
44  const T& v)
45  {
46  return v.begin ();
47  }
48 
49  template<typename S, typename T>
50  typename T::const_iterator op_end_const (const Structure<S>&,
51  const T& v)
52  {
53  return v.end ();
54  }
55 
56  template<typename S, typename T>
57  typename T::reverse_iterator op_rbegin (const Structure<S>&,
58  T& v)
59  {
60  return v.rbegin ();
61  }
62 
63  template<typename S, typename T>
64  typename T::reverse_iterator op_rend (const Structure<S>&,
65  T& v)
66  {
67  return v.rend ();
68  }
69 
70  template<typename S, typename T>
71  typename T::const_reverse_iterator op_rbegin_const (const Structure<S>&,
72  const T& v)
73  {
74  return v.rbegin ();
75  }
76 
77  template<typename S, typename T>
78  typename T::const_reverse_iterator op_rend_const (const Structure<S>&,
79  const T& v)
80  {
81  return v.rend ();
82  }
83 
84  template<typename S, typename T>
85  bool op_empty (const Structure<S>&,
86  const T& v)
87  {
88  return v.empty ();
89  }
90 
91  template<typename S, typename T>
92  size_t op_size (const Structure<S>&,
93  const T& v)
94  {
95  return v.size ();
96  }
97 
98  template<typename S, typename T>
99  size_t op_max_size (const Structure<S>&,
100  const T& v)
101  {
102  return v.max_size ();
103  }
104 
105  template<typename S, typename T, typename U>
106  bool op_contains_e (const Structure<S>&, const T& v,
107  const U& c)
108  {
109  return std::find (v.begin (), v.end (), c) != v.end ();
110  }
111 
112  template<typename S, typename T, typename U>
113  void op_insert (const Structure<S>&, T& v,
114  const U& c)
115  {
116  v.insert (c);
117  }
118 
119  template<typename S, typename T>
120  bool op_is_finite (const Structure<S>&,
121  const T&)
122  {
123  return false;
124  }
125 
126 } // vcsn
127 
128 
129 #endif // ! VCSN_TOOLS_CONTAINER_OPS_HXX