1 | /*==============================================================================
|
---|
2 | Copyright (c) 2011 Steven Watanabe
|
---|
3 |
|
---|
4 | Distributed under the Boost Software License, Version 1.0. (See accompanying
|
---|
5 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
---|
6 | ==============================================================================*/
|
---|
7 |
|
---|
8 | #ifndef BOOST_PHOENIX_CMATH_HPP_INCLUDED
|
---|
9 | #define BOOST_PHOENIX_CMATH_HPP_INCLUDED
|
---|
10 |
|
---|
11 | #include <boost/phoenix/core/limits.hpp>
|
---|
12 | #include <cmath>
|
---|
13 | #include <boost/phoenix/function/adapt_callable.hpp>
|
---|
14 | #include <boost/type_traits/remove_reference.hpp>
|
---|
15 | #include <boost/type_traits/remove_cv.hpp>
|
---|
16 |
|
---|
17 | namespace boost {
|
---|
18 |
|
---|
19 | #define BOOST_PHOENIX_MATH_FUNCTION(name, n) \
|
---|
20 | namespace phoenix_impl { \
|
---|
21 | struct name ## _impl { \
|
---|
22 | template<class Sig> \
|
---|
23 | struct result; \
|
---|
24 | template<class This, BOOST_PHOENIX_typename_A(n)> \
|
---|
25 | struct result<This(BOOST_PHOENIX_A(n))> \
|
---|
26 | { \
|
---|
27 | typedef \
|
---|
28 | typename proto::detail::uncvref<A0>::type \
|
---|
29 | type; \
|
---|
30 | }; \
|
---|
31 | template<BOOST_PHOENIX_typename_A(n)> \
|
---|
32 | A0 operator()(BOOST_PHOENIX_A_const_ref_a(n)) const { \
|
---|
33 | using namespace std; \
|
---|
34 | return name(BOOST_PHOENIX_a(n)); \
|
---|
35 | } \
|
---|
36 | }; \
|
---|
37 | } \
|
---|
38 | namespace phoenix { \
|
---|
39 | BOOST_PHOENIX_ADAPT_CALLABLE(name, phoenix_impl::name ## _impl, n) \
|
---|
40 | }
|
---|
41 |
|
---|
42 | BOOST_PHOENIX_MATH_FUNCTION(acos, 1)
|
---|
43 | BOOST_PHOENIX_MATH_FUNCTION(asin, 1)
|
---|
44 | BOOST_PHOENIX_MATH_FUNCTION(atan, 1)
|
---|
45 | BOOST_PHOENIX_MATH_FUNCTION(atan2, 2)
|
---|
46 | BOOST_PHOENIX_MATH_FUNCTION(ceil, 1)
|
---|
47 | BOOST_PHOENIX_MATH_FUNCTION(cos, 1)
|
---|
48 | BOOST_PHOENIX_MATH_FUNCTION(cosh, 1)
|
---|
49 | BOOST_PHOENIX_MATH_FUNCTION(exp, 1)
|
---|
50 | BOOST_PHOENIX_MATH_FUNCTION(fabs, 1)
|
---|
51 | BOOST_PHOENIX_MATH_FUNCTION(floor, 1)
|
---|
52 | BOOST_PHOENIX_MATH_FUNCTION(fmod, 2)
|
---|
53 | BOOST_PHOENIX_MATH_FUNCTION(frexp, 2)
|
---|
54 | BOOST_PHOENIX_MATH_FUNCTION(ldexp, 2)
|
---|
55 | BOOST_PHOENIX_MATH_FUNCTION(log, 1)
|
---|
56 | BOOST_PHOENIX_MATH_FUNCTION(log10, 1)
|
---|
57 | BOOST_PHOENIX_MATH_FUNCTION(modf, 2)
|
---|
58 | BOOST_PHOENIX_MATH_FUNCTION(pow, 2)
|
---|
59 | BOOST_PHOENIX_MATH_FUNCTION(sin, 1)
|
---|
60 | BOOST_PHOENIX_MATH_FUNCTION(sinh, 1)
|
---|
61 | BOOST_PHOENIX_MATH_FUNCTION(sqrt, 1)
|
---|
62 | BOOST_PHOENIX_MATH_FUNCTION(tan, 1)
|
---|
63 | BOOST_PHOENIX_MATH_FUNCTION(tanh, 1)
|
---|
64 |
|
---|
65 | #undef BOOST_PHOENIX_MATH_FUNCTION
|
---|
66 |
|
---|
67 | }
|
---|
68 |
|
---|
69 | #endif
|
---|