container_ops.hxx

00001 // container_ops.hxx: this file is part of the Vaucanson project.
00002 //
00003 // Vaucanson, a generic library for finite state machines.
00004 //
00005 // Copyright (C) 2001, 2002, 2003, 2004 The Vaucanson Group.
00006 //
00007 // This program is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2
00010 // of the License, or (at your option) any later version.
00011 //
00012 // The complete GNU General Public Licence Notice can be found as the
00013 // `COPYING' file in the root directory.
00014 //
00015 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
00016 //
00017 #ifndef VCSN_TOOLS_CONTAINER_OPS_HXX
00018 # define VCSN_TOOLS_CONTAINER_OPS_HXX
00019 
00020 # include <algorithm>
00021 
00022 # include <vaucanson/tools/container_ops.hh>
00023 # include <vaucanson/design_pattern/predecls.hh>
00024 
00025 namespace vcsn
00026 {
00027 
00028   template<typename S, typename T>
00029   typename T::iterator op_begin(const Structure<S>&,
00030                                 T& v)
00031   {
00032     return v.begin();
00033   }
00034 
00035   template<typename S, typename T>
00036   typename T::iterator op_end(const Structure<S>&,
00037                               T& v)
00038   {
00039     return v.end();
00040   }
00041 
00042   template<typename S, typename T>
00043   typename T::const_iterator op_begin_const(const Structure<S>&,
00044                                             const T& v)
00045   {
00046     return v.begin();
00047   }
00048 
00049   template<typename S, typename T>
00050   typename T::const_iterator op_end_const(const Structure<S>&,
00051                                           const T& v)
00052   {
00053     return v.end();
00054   }
00055 
00056   template<typename S, typename T>
00057   typename T::reverse_iterator op_rbegin(const Structure<S>&,
00058                                          T& v)
00059   {
00060     return v.rbegin();
00061   }
00062 
00063   template<typename S, typename T>
00064   typename T::reverse_iterator op_rend(const Structure<S>&,
00065                                        T& v)
00066   {
00067     return v.rend();
00068   }
00069 
00070   template<typename S, typename T>
00071   typename T::const_reverse_iterator op_rbegin_const(const Structure<S>&,
00072                                                      const T& v)
00073   {
00074     return v.rbegin();
00075   }
00076 
00077   template<typename S, typename T>
00078   typename T::const_reverse_iterator op_rend_const(const Structure<S>&,
00079                                                    const T& v)
00080   {
00081     return v.rend();
00082   }
00083 
00084   template<typename S, typename T>
00085   bool op_empty(const Structure<S>&,
00086                 const T& v)
00087   {
00088     return v.empty();
00089   }
00090 
00091   template<typename S, typename T>
00092   size_t op_size(const Structure<S>&,
00093                  const T& v)
00094   {
00095     return v.size();
00096   }
00097 
00098   template<typename S, typename T>
00099   size_t op_max_size(const Structure<S>&,
00100                      const T& v)
00101   {
00102     return v.max_size();
00103   }
00104 
00105   template<typename S, typename T, typename U>
00106   bool op_contains_e(const Structure<S>&, const T& v,
00107                      const U& c)
00108   {
00109     return std::find(v.begin(), v.end(), c) != v.end();
00110   }
00111 
00112   template<typename S, typename T, typename U>
00113   void op_insert(const Structure<S>&, T& v,
00114                  const U& c)
00115   {
00116     v.insert(c);
00117   }
00118 
00119   template<typename S, typename T>
00120   bool op_is_finite(const Structure<S>&,
00121                     const T&)
00122   {
00123     return false;
00124   }
00125 
00126 } // vcsn
00127 
00128 
00129 #endif // ! VCSN_TOOLS_CONTAINER_OPS_HXX

Generated on Fri Jul 28 12:18:30 2006 for Vaucanson by  doxygen 1.4.6