annotate DEPENDENCIES/generic/include/boost/proto/expr.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 ///////////////////////////////////////////////////////////////////////////////
Chris@16 2 /// \file expr.hpp
Chris@16 3 /// Contains definition of expr\<\> class template.
Chris@16 4 //
Chris@16 5 // Copyright 2008 Eric Niebler. Distributed under the Boost
Chris@16 6 // Software License, Version 1.0. (See accompanying file
Chris@16 7 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 8
Chris@16 9 #ifndef BOOST_PROTO_EXPR_HPP_EAN_04_01_2005
Chris@16 10 #define BOOST_PROTO_EXPR_HPP_EAN_04_01_2005
Chris@16 11
Chris@16 12 #include <boost/preprocessor/cat.hpp>
Chris@16 13 #include <boost/preprocessor/arithmetic/dec.hpp>
Chris@16 14 #include <boost/preprocessor/selection/max.hpp>
Chris@16 15 #include <boost/preprocessor/iteration/iterate.hpp>
Chris@16 16 #include <boost/preprocessor/facilities/intercept.hpp>
Chris@16 17 #include <boost/preprocessor/repetition/repeat.hpp>
Chris@16 18 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
Chris@16 19 #include <boost/preprocessor/repetition/enum_trailing.hpp>
Chris@16 20 #include <boost/preprocessor/repetition/enum_params.hpp>
Chris@16 21 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
Chris@16 22 #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
Chris@16 23 #include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp>
Chris@16 24 #include <boost/utility/addressof.hpp>
Chris@16 25 #include <boost/proto/proto_fwd.hpp>
Chris@16 26 #include <boost/proto/args.hpp>
Chris@16 27 #include <boost/proto/traits.hpp>
Chris@16 28
Chris@101 29 #if defined(_MSC_VER)
Chris@16 30 # pragma warning(push)
Chris@16 31 # pragma warning(disable : 4510) // default constructor could not be generated
Chris@16 32 # pragma warning(disable : 4512) // assignment operator could not be generated
Chris@16 33 # pragma warning(disable : 4610) // user defined constructor required
Chris@16 34 # pragma warning(disable : 4714) // function 'xxx' marked as __forceinline not inlined
Chris@16 35 #endif
Chris@16 36
Chris@16 37 namespace boost { namespace proto
Chris@16 38 {
Chris@16 39
Chris@16 40 namespace detail
Chris@16 41 {
Chris@16 42 struct not_a_valid_type
Chris@16 43 {
Chris@16 44 private:
Chris@16 45 not_a_valid_type()
Chris@16 46 {}
Chris@16 47 };
Chris@16 48
Chris@16 49 template<typename Tag, typename Arg>
Chris@16 50 struct address_of_hack
Chris@16 51 {
Chris@16 52 typedef not_a_valid_type type;
Chris@16 53 };
Chris@16 54
Chris@16 55 template<typename Expr>
Chris@16 56 struct address_of_hack<proto::tag::address_of, Expr &>
Chris@16 57 {
Chris@16 58 typedef Expr *type;
Chris@16 59 };
Chris@16 60
Chris@16 61 template<typename T, typename Expr, typename Arg0>
Chris@16 62 BOOST_FORCEINLINE
Chris@16 63 Expr make_terminal(T &t, Expr *, proto::term<Arg0> *)
Chris@16 64 {
Chris@16 65 Expr that = {t};
Chris@16 66 return that;
Chris@16 67 }
Chris@16 68
Chris@16 69 template<typename T, typename Expr, typename Arg0, std::size_t N>
Chris@16 70 BOOST_FORCEINLINE
Chris@16 71 Expr make_terminal(T (&t)[N], Expr *, proto::term<Arg0[N]> *)
Chris@16 72 {
Chris@16 73 Expr that;
Chris@16 74 for(std::size_t i = 0; i < N; ++i)
Chris@16 75 {
Chris@16 76 that.child0[i] = t[i];
Chris@16 77 }
Chris@16 78 return that;
Chris@16 79 }
Chris@16 80
Chris@16 81 template<typename T, typename Expr, typename Arg0, std::size_t N>
Chris@16 82 BOOST_FORCEINLINE
Chris@16 83 Expr make_terminal(T const(&t)[N], Expr *, proto::term<Arg0[N]> *)
Chris@16 84 {
Chris@16 85 Expr that;
Chris@16 86 for(std::size_t i = 0; i < N; ++i)
Chris@16 87 {
Chris@16 88 that.child0[i] = t[i];
Chris@16 89 }
Chris@16 90 return that;
Chris@16 91 }
Chris@16 92
Chris@16 93 // Work-around for:
Chris@16 94 // https://connect.microsoft.com/VisualStudio/feedback/details/765449/codegen-stack-corruption-using-runtime-checks-when-aggregate-initializing-struct
Chris@16 95 #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1700))
Chris@16 96 template<typename T, typename Expr, typename C, typename U>
Chris@16 97 BOOST_FORCEINLINE
Chris@16 98 Expr make_terminal(T &t, Expr *, proto::term<U C::*> *)
Chris@16 99 {
Chris@16 100 Expr that;
Chris@16 101 that.child0 = t;
Chris@16 102 return that;
Chris@16 103 }
Chris@16 104 #endif
Chris@16 105
Chris@16 106 template<typename T, typename U>
Chris@16 107 struct same_cv
Chris@16 108 {
Chris@16 109 typedef U type;
Chris@16 110 };
Chris@16 111
Chris@16 112 template<typename T, typename U>
Chris@16 113 struct same_cv<T const, U>
Chris@16 114 {
Chris@16 115 typedef U const type;
Chris@16 116 };
Chris@16 117 }
Chris@16 118
Chris@16 119 namespace result_of
Chris@16 120 {
Chris@16 121 /// \brief A helper metafunction for computing the
Chris@16 122 /// return type of \c proto::expr\<\>::operator().
Chris@16 123 template<typename Sig, typename This, typename Domain>
Chris@16 124 struct funop;
Chris@16 125
Chris@16 126 #include <boost/proto/detail/funop.hpp>
Chris@16 127 }
Chris@16 128
Chris@16 129 namespace exprns_
Chris@16 130 {
Chris@16 131 // This is where the basic_expr specializations are
Chris@16 132 // actually defined:
Chris@16 133 #include <boost/proto/detail/basic_expr.hpp>
Chris@16 134
Chris@16 135 // This is where the expr specialization are
Chris@16 136 // actually defined:
Chris@16 137 #include <boost/proto/detail/expr.hpp>
Chris@16 138 }
Chris@16 139
Chris@16 140 /// \brief Lets you inherit the interface of an expression
Chris@16 141 /// while hiding from Proto the fact that the type is a Proto
Chris@16 142 /// expression.
Chris@16 143 template<typename Expr>
Chris@16 144 struct unexpr
Chris@16 145 : Expr
Chris@16 146 {
Chris@16 147 BOOST_PROTO_UNEXPR()
Chris@16 148
Chris@16 149 BOOST_FORCEINLINE
Chris@16 150 explicit unexpr(Expr const &e)
Chris@16 151 : Expr(e)
Chris@16 152 {}
Chris@16 153
Chris@16 154 using Expr::operator =;
Chris@16 155 };
Chris@16 156
Chris@16 157 }}
Chris@16 158
Chris@101 159 #if defined(_MSC_VER)
Chris@16 160 # pragma warning(pop)
Chris@16 161 #endif
Chris@16 162
Chris@16 163 #endif // BOOST_PROTO_EXPR_HPP_EAN_04_01_2005