/////////////////////////////////////////////////////////////////////////////// /// \file as_expr.hpp /// Contains definition of the as_expr\<\> and as_child\<\> helper class /// templates used to implement proto::domain's as_expr\<\> and as_child\<\> /// member templates. // // Copyright 2010 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_PROTO_DETAIL_AS_EXPR_HPP_EAN_06_09_2010 #define BOOST_PROTO_DETAIL_AS_EXPR_HPP_EAN_06_09_2010 #include #include #include #include #include #if defined(_MSC_VER) # pragma warning(push) # pragma warning(disable : 4714) // function 'xxx' marked as __forceinline not inlined #endif namespace boost { namespace proto { namespace detail { //////////////////////////////////////////////////////////////////////////////////////////////// template struct base_generator { typedef Generator type; }; template struct base_generator > { typedef Generator type; }; //////////////////////////////////////////////////////////////////////////////////////////////// template struct as_expr; //////////////////////////////////////////////////////////////////////////////////////////////// template struct as_expr { typedef typename term_traits::value_type value_type; typedef proto::expr, 0> expr_type; typedef typename Generator::template result::type result_type; BOOST_FORCEINLINE result_type operator()(T &t) const { return Generator()(expr_type::make(t)); } }; //////////////////////////////////////////////////////////////////////////////////////////////// template struct as_expr { typedef typename term_traits::value_type value_type; typedef proto::basic_expr, 0> expr_type; typedef typename Generator::template result::type result_type; BOOST_FORCEINLINE result_type operator()(T &t) const { return Generator()(expr_type::make(t)); } }; //////////////////////////////////////////////////////////////////////////////////////////////// template struct as_expr { typedef typename term_traits::value_type value_type; typedef proto::expr, 0> result_type; BOOST_FORCEINLINE result_type operator()(T &t) const { return result_type::make(t); } }; //////////////////////////////////////////////////////////////////////////////////////////////// template struct as_expr { typedef typename term_traits::value_type value_type; typedef proto::basic_expr, 0> result_type; BOOST_FORCEINLINE result_type operator()(T &t) const { return result_type::make(t); } }; //////////////////////////////////////////////////////////////////////////////////////////////// template struct as_child; //////////////////////////////////////////////////////////////////////////////////////////////// template struct as_child { #if BOOST_WORKAROUND(BOOST_MSVC, == 1310) typedef typename term_traits::reference reference; #else typedef T &reference; #endif typedef proto::expr, 0> expr_type; typedef typename Generator::template result::type result_type; BOOST_FORCEINLINE result_type operator()(T &t) const { return Generator()(expr_type::make(t)); } }; //////////////////////////////////////////////////////////////////////////////////////////////// template struct as_child { #if BOOST_WORKAROUND(BOOST_MSVC, == 1310) typedef typename term_traits::reference reference; #else typedef T &reference; #endif typedef proto::basic_expr, 0> expr_type; typedef typename Generator::template result::type result_type; BOOST_FORCEINLINE result_type operator()(T &t) const { return Generator()(expr_type::make(t)); } }; //////////////////////////////////////////////////////////////////////////////////////////////// template struct as_child { #if BOOST_WORKAROUND(BOOST_MSVC, == 1310) typedef typename term_traits::reference reference; #else typedef T &reference; #endif typedef proto::expr, 0> result_type; BOOST_FORCEINLINE result_type operator()(T &t) const { return result_type::make(t); } }; //////////////////////////////////////////////////////////////////////////////////////////////// template struct as_child { #if BOOST_WORKAROUND(BOOST_MSVC, == 1310) typedef typename term_traits::reference reference; #else typedef T &reference; #endif typedef proto::basic_expr, 0> result_type; BOOST_FORCEINLINE result_type operator()(T &t) const { return result_type::make(t); } }; }}} #if defined(_MSC_VER) # pragma warning(pop) #endif #endif