/////////////////////////////////////////////////////////////////////////////// /// \file expr.hpp /// Contains definition of expr\<\> class template. // // Copyright 2008 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_EXPR_HPP_EAN_04_01_2005 #define BOOST_PROTO_EXPR_HPP_EAN_04_01_2005 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if defined(_MSC_VER) # pragma warning(push) # pragma warning(disable : 4510) // default constructor could not be generated # pragma warning(disable : 4512) // assignment operator could not be generated # pragma warning(disable : 4610) // user defined constructor required # pragma warning(disable : 4714) // function 'xxx' marked as __forceinline not inlined #endif namespace boost { namespace proto { namespace detail { struct not_a_valid_type { private: not_a_valid_type() {} }; template struct address_of_hack { typedef not_a_valid_type type; }; template struct address_of_hack { typedef Expr *type; }; template BOOST_FORCEINLINE Expr make_terminal(T &t, Expr *, proto::term *) { Expr that = {t}; return that; } template BOOST_FORCEINLINE Expr make_terminal(T (&t)[N], Expr *, proto::term *) { Expr that; for(std::size_t i = 0; i < N; ++i) { that.child0[i] = t[i]; } return that; } template BOOST_FORCEINLINE Expr make_terminal(T const(&t)[N], Expr *, proto::term *) { Expr that; for(std::size_t i = 0; i < N; ++i) { that.child0[i] = t[i]; } return that; } // Work-around for: // https://connect.microsoft.com/VisualStudio/feedback/details/765449/codegen-stack-corruption-using-runtime-checks-when-aggregate-initializing-struct #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1700)) template BOOST_FORCEINLINE Expr make_terminal(T &t, Expr *, proto::term *) { Expr that; that.child0 = t; return that; } #endif template struct same_cv { typedef U type; }; template struct same_cv { typedef U const type; }; } namespace result_of { /// \brief A helper metafunction for computing the /// return type of \c proto::expr\<\>::operator(). template struct funop; #include } namespace exprns_ { // This is where the basic_expr specializations are // actually defined: #include // This is where the expr specialization are // actually defined: #include } /// \brief Lets you inherit the interface of an expression /// while hiding from Proto the fact that the type is a Proto /// expression. template struct unexpr : Expr { BOOST_PROTO_UNEXPR() BOOST_FORCEINLINE explicit unexpr(Expr const &e) : Expr(e) {} using Expr::operator =; }; }} #if defined(_MSC_VER) # pragma warning(pop) #endif #endif // BOOST_PROTO_EXPR_HPP_EAN_04_01_2005