Ticket #6665: cmath.hpp

File cmath.hpp, 3.0 KB (added by alfredo.correa@…, 11 years ago)

corrected file

Line 
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
17namespace 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
42BOOST_PHOENIX_MATH_FUNCTION(acos, 1)
43BOOST_PHOENIX_MATH_FUNCTION(asin, 1)
44BOOST_PHOENIX_MATH_FUNCTION(atan, 1)
45BOOST_PHOENIX_MATH_FUNCTION(atan2, 2)
46BOOST_PHOENIX_MATH_FUNCTION(ceil, 1)
47BOOST_PHOENIX_MATH_FUNCTION(cos, 1)
48BOOST_PHOENIX_MATH_FUNCTION(cosh, 1)
49BOOST_PHOENIX_MATH_FUNCTION(exp, 1)
50BOOST_PHOENIX_MATH_FUNCTION(fabs, 1)
51BOOST_PHOENIX_MATH_FUNCTION(floor, 1)
52BOOST_PHOENIX_MATH_FUNCTION(fmod, 2)
53BOOST_PHOENIX_MATH_FUNCTION(frexp, 2)
54BOOST_PHOENIX_MATH_FUNCTION(ldexp, 2)
55BOOST_PHOENIX_MATH_FUNCTION(log, 1)
56BOOST_PHOENIX_MATH_FUNCTION(log10, 1)
57BOOST_PHOENIX_MATH_FUNCTION(modf, 2)
58BOOST_PHOENIX_MATH_FUNCTION(pow, 2)
59BOOST_PHOENIX_MATH_FUNCTION(sin, 1)
60BOOST_PHOENIX_MATH_FUNCTION(sinh, 1)
61BOOST_PHOENIX_MATH_FUNCTION(sqrt, 1)
62BOOST_PHOENIX_MATH_FUNCTION(tan, 1)
63BOOST_PHOENIX_MATH_FUNCTION(tanh, 1)
64
65#undef BOOST_PHOENIX_MATH_FUNCTION
66
67}
68
69#endif