/* Copyright (c) 1997-2004
   Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Berlin, Germany)
   http://www.math.tu-berlin.de/polymake,  mailto:polymake@math.tu-berlin.de

   This program is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the
   Free Software Foundation; either version 2, or (at your option) any
   later version: http://www.gnu.org/licenses/gpl.txt.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
*/

#ifndef _POLYMAKE_CONVERTERS_BASIC_DEFS_H
#define _POLYMAKE_CONVERTERS_BASIC_DEFS_H "$Project: polymake $$Id: converters_basic_defs.h 4714 2004-06-22 16:23:15Z gawrilow $"

#ifndef _POLYMAKE_TYPE_MANIP_H
#  include <type_manip.h>
#endif

namespace pm {

/** Type converter
    The primary template can't make any exotic assumptions about types to be converted.
    The only thing it can rely upon is an user-defined or built-in conversion operator
    or constructor.

    Specializations of this template may make use of some specific conversion routines
    that can't be called implicitly in C++.
*/
template <class From, class To>
struct conv {
   typedef From argument_type;
   typedef const To result_type;
   result_type operator() (typename function_argument<From>::type x) const { return result_type(x); }
};

/// Trivial conversion of a type to itself
template <class T>
struct conv<T,T> {
   typedef T argument_type;
   typedef const T& result_type;
   result_type operator() (const T& x) const { return x; }
};

} // end namespace pm

#endif // _POLYMAKE_CONVERTERS_BASIC_DEFS_H

// Local Variables:
// mode:C++
// End:
