1 /*============================================================================= 2 Phoenix V1.2.1 3 Copyright (c) 2001-2003 Joel de Guzman 4 5 Use, modification and distribution is subject to the Boost Software 6 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 http://www.boost.org/LICENSE_1_0.txt) 8 ==============================================================================*/ 9 #include <vector> 10 #include <algorithm> 11 #include <iostream> 12 #include <boost/spirit/include/phoenix1_operators.hpp> 13 #include <boost/spirit/include/phoenix1_primitives.hpp> 14 15 using namespace std; 16 using namespace phoenix; 17 18 ////////////////////////////////// 19 template <int N> 20 struct static_int { 21 22 template <typename TupleT> 23 struct result { typedef int type; }; 24 25 template <typename TupleT> evalstatic_int26 int eval(TupleT const&) const { return N; } 27 }; 28 29 ////////////////////////////////// 30 template <int N> 31 phoenix::actor<static_int<N> > int_const()32int_const() 33 { 34 return static_int<N>(); 35 } 36 37 ////////////////////////////////// 38 int main()39main() 40 { 41 cout << (int_const<5>() + int_const<6>())() << endl; 42 return 0; 43 } 44