- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

# tools.hxx

    00001 // tools.hxx: this file is part of the Vaucanson project.
    00002 //
    00003 // Vaucanson, a generic library for finite state machines.
    00004 //
    00005 // Copyright (C) 2004, 2005, 2007 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_ALGEBRA_IMPLEMENTATION_FREE_MONOID_TOOLS_HXX
    00018 # define VCSN_ALGEBRA_IMPLEMENTATION_FREE_MONOID_TOOLS_HXX
    00019
    00020 # include <vaucanson/algebra/implementation/free_monoid/tools.hh>
    00021
    00022 namespace vcsn {
    00023
    00024   namespace algebra {
    00025
    00026     template<typename A>
    00027     const std::list<typename A::letter_t>&
    00028     identity_value(SELECTOR(algebra::FreeMonoidBase<A>),
    00029                    SELECTOR(std::list<typename A::letter_t>))
    00030     {
    00031       static const std::list<typename A::letter_t> instance;
    00032       return instance;
    00033     }
    00034
    00035     template<typename A>
    00036     std::list<typename A::letter_t>
    00037     op_convert(SELECTOR(algebra::FreeMonoidBase<A>),
    00038                SELECTOR(std::list<typename A::letter_t>),
    00039                const typename A::letter_t& c)
    00040     {
    00041       std::list<typename A::letter_t> l;
    00042       l.push_back(c);
    00043       return l;
    00044     }
    00045
    00046     template <typename A>
    00047     void
    00048     op_in_mul(const algebra::FreeMonoidBase<A>& s,
    00049               std::list<typename A::letter_t>& dst,
    00050               const std::list<typename A::letter_t>& src)
    00051     {
    00052       typedef typename std::list<typename A::letter_t>::const_iterator it_t;
    00053       for (it_t i = src.begin();
    00054            i != src.end();
    00055            i++)
    00056         dst.push_back(*i);
    00057     }
    00058
    00059     template <typename A>
    00060     std::list<typename A::letter_t>
    00061     op_mul(const algebra::FreeMonoidBase<A>& s,
    00062            const std::list<typename A::letter_t>& a,
    00063            const std::list<typename A::letter_t>& b)
    00064     {
    00065       typedef typename std::list<typename A::letter_t>::const_iterator it_t;
    00066       std::list<typename A::letter_t> ret(a);
    00067       op_in_mul(s, ret, b);
    00068       return ret;
    00069     }
    00070
    00071   } // algebra
    00072
    00073 } // vcsn
    00074
    00075 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_FREE_MONOID_TOOLS_HXX