/////////////////////////////////////////////////////////////////////////////// /// \file functional_fwd.hpp /// // Copyright 2005 Eric Niebler. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_NUMERIC_FUNCTIONAL_FWD_HPP_EAN_08_12_2005 #define BOOST_NUMERIC_FUNCTIONAL_FWD_HPP_EAN_08_12_2005 #include #include #include #include #include namespace boost { namespace numeric { // For using directives -- this namespace may be re-opened elsewhere namespace operators {} namespace op { using mpl::_; using mpl::_1; using mpl::_2; } namespace functional { using namespace operators; template struct tag { typedef void type; }; template struct tag : tag {}; template struct tag : tag {}; template struct tag : tag {}; template struct static_; template struct are_integral; } /// INTERNAL ONLY /// #define BOOST_NUMERIC_FUNCTIONAL_DECLARE_UNARY_OP(Name, Op) \ namespace functional \ { \ template \ struct Name ## _base; \ template::type> \ struct Name; \ } \ namespace op \ { \ struct Name; \ } \ namespace \ { \ extern op::Name const &Name; \ } /// INTERNAL ONLY /// #define BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(Name) \ namespace functional \ { \ template \ struct result_of_ ## Name; \ template \ struct Name ## _base; \ template< \ typename Left \ , typename Right \ , typename LeftTag = typename tag::type \ , typename RightTag = typename tag::type \ > \ struct Name; \ } \ namespace op \ { \ struct Name; \ } \ namespace \ { \ extern op::Name const &Name; \ } BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(plus) BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(minus) BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(multiplies) BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(divides) BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(modulus) BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(greater) BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(greater_equal) BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(less) BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(less_equal) BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(equal_to) BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(not_equal_to) BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(assign) BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(plus_assign) BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(minus_assign) BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(multiplies_assign) BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(divides_assign) BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(modulus_assign) BOOST_NUMERIC_FUNCTIONAL_DECLARE_UNARY_OP(unary_plus, +) BOOST_NUMERIC_FUNCTIONAL_DECLARE_UNARY_OP(unary_minus, -) BOOST_NUMERIC_FUNCTIONAL_DECLARE_UNARY_OP(complement, ~) BOOST_NUMERIC_FUNCTIONAL_DECLARE_UNARY_OP(logical_not, !) #undef BOOST_NUMERIC_FUNCTIONAL_DECLARE_UNARY_OP #undef BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP namespace functional { template struct promote_base; template struct min_assign_base; template struct max_assign_base; template struct average_base; template struct as_min_base; template struct as_max_base; template struct as_zero_base; template struct as_one_base; template::type, typename FromTag = typename tag::type> struct promote; template::type, typename RightTag = typename tag::type> struct min_assign; template::type, typename RightTag = typename tag::type> struct max_assign; template::type, typename RightTag = typename tag::type> struct average; template::type> struct as_min; template::type> struct as_max; template::type> struct as_zero; template::type> struct as_one; } namespace op { template struct promote; struct min_assign; struct max_assign; struct average; struct as_min; struct as_max; struct as_zero; struct as_one; } namespace { extern op::min_assign const &min_assign; extern op::max_assign const &max_assign; extern op::average const &average; extern op::as_min const &as_min; extern op::as_max const &as_max; extern op::as_zero const &as_zero; extern op::as_one const &as_one; } template typename lazy_disable_if, mpl::if_, To &, To> >::type promote(From &from); template typename mpl::if_, To const &, To const>::type promote(From const &from); template struct default_; template struct one; template struct zero; template struct one_or_default; template struct zero_or_default; }} // namespace boost::numeric #endif