/******************************************************************************* * * TRIQS: a Toolbox for Research in Interacting Quantum Systems * * Copyright (C) 2011 by O. Parcollet * * TRIQS 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 3 of the License, or (at your option) any later * version. * * TRIQS 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. * * You should have received a copy of the GNU General Public License along with * TRIQS. If not, see . * ******************************************************************************/ #ifndef TRIQS_UTILITY_EXPRESSION_TEMPLATE_TOOLS_H #define TRIQS_UTILITY_EXPRESSION_TEMPLATE_TOOLS_H #include #include namespace triqs { namespace utility { namespace tags { struct plus{}; struct minus{}; struct multiplies{}; struct divides{}; } // The basic operations put in a template.... template struct operation; template<> struct operation { template auto operator()(L const & l, R const & r) const -> decltype(l+r) { return l+r;} static const char name = '+'; }; template<> struct operation { template auto operator()(L const & l, R const & r) const -> decltype(l-r) { return l-r;} static const char name = '-'; }; template<> struct operation { template auto operator()(L const & l, R const & r) const -> decltype(l*r) { return l*r;} static const char name = '*'; }; template<> struct operation { template auto operator()(L const & l, R const & r) const -> decltype(l/r) { return l/r;} static const char name = '/'; }; // The scalar ... template struct is_in_ZRC : std::is_arithmetic {}; template<> struct is_in_ZRC : std::true_type {}; template struct is_in_ZRC > : std::true_type {}; template struct type_of_mult{ typedef decltype ( std::declval::type>() * std::declval::type>() ) type; }; }}//namespace triqs::utility #endif