/******************************************************************************* * * 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 #include "./macros.hpp" namespace triqs { namespace utility { template struct remove_rvalue_ref {typedef T type;}; template struct remove_rvalue_ref {typedef T const & type;}; template struct remove_rvalue_ref {typedef T type;}; 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 && l, R && r) const DECL_AND_RETURN(std::forward(l) + std::forward(r)); static const char name = '+'; }; template<> struct operation { template auto operator()(L && l, R && r) const DECL_AND_RETURN(std::forward(l) - std::forward(r)); static const char name = '-'; }; template<> struct operation { template auto operator()(L && l, R && r) const DECL_AND_RETURN(std::forward(l) * std::forward(r)); static const char name = '*'; }; template<> struct operation { template auto operator()(L && l, R && r) const DECL_AND_RETURN(std::forward(l) / std::forward(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 is_in_ZRC : is_in_ZRC{}; template struct is_in_ZRC : is_in_ZRC{}; template struct is_in_ZRC : is_in_ZRC{}; template struct type_of_mult{ typedef decltype ( std::declval::type>() * std::declval::type>() ) type; }; }}//namespace triqs::utility #endif