1 /*============================================================================== 2 Copyright (c) 2001-2010 Joel de Guzman 3 Copyright (c) 2010 Eric Niebler 4 Copyright (c) 2010-2011 Thomas Heller 5 6 Distributed under the Boost Software License, Version 1.0. (See accompanying 7 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 ==============================================================================*/ 9 #ifndef BOOST_PHOENIX_CORE_ARGUMENT_HPP 10 #define BOOST_PHOENIX_CORE_ARGUMENT_HPP 11 12 #include <boost/phoenix/core/limits.hpp> 13 #include <boost/phoenix/core/actor.hpp> 14 #include <boost/phoenix/core/expression.hpp> 15 #include <boost/phoenix/core/terminal.hpp> 16 #include <boost/mpl/int.hpp> 17 18 namespace boost { namespace phoenix 19 { 20 //////////////////////////////////////////////////////////////////////////// 21 // 22 // argument 23 // 24 // function for evaluating argument placeholders like: _1 25 // 26 //////////////////////////////////////////////////////////////////////////// 27 28 template <int I> 29 struct argument 30 //: mpl::int_<I> 31 { 32 typedef typename mpl::int_<I>::value_type value_type; 33 static const value_type value = mpl::int_<I>::value; 34 operator ==boost::phoenix::argument35 bool operator==(argument) const 36 { 37 return true; 38 } 39 40 template <int I2> operator ==boost::phoenix::argument41 bool operator==(argument<I2>) const 42 { 43 return false; 44 } 45 }; 46 }} 47 48 namespace boost { 49 template <int I> 50 struct is_placeholder<phoenix::argument<I> > 51 : mpl::int_<I> 52 {}; 53 } 54 55 namespace boost { namespace phoenix 56 { 57 namespace expression 58 { 59 template <int I> 60 struct argument 61 : expression::terminal<phoenix::argument<I> > 62 { 63 typedef typename expression::terminal<phoenix::argument<I> >::type type; makeboost::phoenix::expression::argument64 static const type make() 65 { 66 type const e = {{{}}}; 67 return e; 68 } 69 }; 70 } 71 72 #if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES) 73 74 #include <boost/phoenix/core/detail/cpp03/preprocessed/argument.hpp> 75 76 #else 77 78 #if !defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES) 79 #include <boost/phoenix/core/detail/argument.hpp> 80 #else 81 82 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES) 83 #pragma wave option(preserve: 2, line: 0, output: "detail/cpp03/preprocessed/argument_predefined_" BOOST_PHOENIX_LIMIT_STR ".hpp") 84 #endif 85 /*============================================================================== 86 Copyright (c) 2001-2010 Joel de Guzman 87 Copyright (c) 2010-2011 Thomas Heller 88 89 Distributed under the Boost Software License, Version 1.0. (See accompanying 90 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 91 ==============================================================================*/ 92 93 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES) 94 #pragma wave option(preserve: 1) 95 #endif 96 97 #ifdef BOOST_PHOENIX_NO_PREDEFINED_TERMINALS 98 #undef BOOST_PHOENIX_NO_PREDEFINED_TERMINALS 99 #define BOOST_PHOENIX_NO_PREDEFINED_TERMINALS_RESTORE 100 #endif 101 102 #include <boost/phoenix/core/detail/argument.hpp> 103 104 #ifndef BOOST_PHOENIX_NO_PREDEFINED_TERMINALS_RESTORE 105 #define BOOST_PHOENIX_NO_PREDEFINED_TERMINALS 106 #undef BOOST_PHOENIX_NO_PREDEFINED_TERIMINALS_RESTORE 107 #endif 108 109 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES) 110 #pragma wave option(output: null) 111 #endif 112 113 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES) 114 #pragma wave option(preserve: 2, line: 0, output: "detail/cpp03/preprocessed/argument_no_predefined_" BOOST_PHOENIX_LIMIT_STR ".hpp") 115 #endif 116 /*============================================================================== 117 Copyright (c) 2001-2010 Joel de Guzman 118 Copyright (c) 2010-2011 Thomas Heller 119 120 Distributed under the Boost Software License, Version 1.0. (See accompanying 121 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 122 ==============================================================================*/ 123 124 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES) 125 #pragma wave option(preserve: 1) 126 #endif 127 128 #ifndef BOOST_PHOENIX_NO_PREDEFINED_TERMINALS 129 #define BOOST_PHOENIX_NO_PREDEFINED_TERMINALS 130 #define BOOST_PHOENIX_NO_PREDEFINED_TERMINALS_RESTORE 131 #endif 132 133 #include <boost/phoenix/core/detail/argument.hpp> 134 135 #ifndef BOOST_PHOENIX_NO_PREDEFINED_TERMINALS_RESTORE 136 #undef BOOST_PHOENIX_NO_PREDEFINED_TERMINALS 137 #undef BOOST_PHOENIX_NO_PREDEFINED_TERIMINALS_RESTORE 138 #endif 139 140 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES) 141 #pragma wave option(output: null) 142 #endif 143 144 #endif 145 146 #endif 147 148 }} 149 150 #endif 151