Fix build with boost 1.56.0 and later
https://sourceforge.net/p/hugin/hugin/ci/e237d6d1d87354f974d37a95ba52dbd9666dd310/
|
old
|
new
|
|
| 34 | 34 | #include <limits> |
| 35 | 35 | #include <iterator> |
| 36 | 36 | |
| | 37 | #define BOOST_SPIRIT_USE_PHOENIX_V3 1 |
| 37 | 38 | #include <boost/spirit/version.hpp> |
| 38 | 39 | #if !defined(SPIRIT_VERSION) || SPIRIT_VERSION < 0x2010 |
| 39 | 40 | #error "At least Spirit version 2.1 required" |
| … |
… |
|
| 50 | 51 | //power function |
| 51 | 52 | struct lazy_pow_ |
| 52 | 53 | { |
| 53 | | template <typename X, typename Y> |
| 54 | | struct result { typedef X type; }; |
| | 54 | typedef double result_type; |
| 55 | 55 | |
| 56 | | template <typename X, typename Y> |
| 57 | | X operator()(X x, Y y) const |
| | 56 | double operator()(double x, double y) const |
| 58 | 57 | { |
| 59 | 58 | return std::pow(x, y); |
| 60 | 59 | } |
| … |
… |
|
| 63 | 62 | // modulus for double values |
| 64 | 63 | struct lazy_mod_ |
| 65 | 64 | { |
| 66 | | template <typename X, typename Y> |
| 67 | | struct result { typedef X type; }; |
| | 65 | typedef double result_type; |
| 68 | 66 | |
| 69 | | template <typename X, typename Y> |
| 70 | | X operator()(X x, Y y) const |
| | 67 | double operator()(double x, double y) const |
| 71 | 68 | { |
| 72 | 69 | return std::fmod(x,y); |
| 73 | 70 | } |
| … |
… |
|
| 76 | 73 | // if statement |
| 77 | 74 | struct lazy_if_ |
| 78 | 75 | { |
| 79 | | template <typename X, typename Y, typename Z> |
| 80 | | struct result { typedef Y type; }; |
| | 76 | typedef double result_type; |
| 81 | 77 | |
| 82 | | template <typename X, typename Y, typename Z> |
| 83 | | X operator()(X x, Y y, Z z) const |
| | 78 | double operator()(double x, double y, double z) const |
| 84 | 79 | { |
| 85 | | return x ? y : z; |
| | 80 | return (std::fabs(x)>1e-5) ? y : z; |
| 86 | 81 | } |
| 87 | 82 | }; |
| 88 | 83 | |
| 89 | 84 | // wrapper for unary function |
| 90 | 85 | struct lazy_ufunc_ |
| 91 | 86 | { |
| 92 | | template <typename F, typename A1> |
| 93 | | struct result { typedef A1 type; }; |
| | 87 | typedef double result_type; |
| 94 | 88 | |
| 95 | | template <typename F, typename A1> |
| 96 | | A1 operator()(F f, A1 a1) const |
| | 89 | double operator()(double (*f)(double), double a1) const |
| 97 | 90 | { |
| 98 | 91 | return f(a1); |
| 99 | 92 | } |
| 100 | 93 | }; |
| 101 | 94 | |
| 102 | 95 | // convert rad into deg |
| 103 | | double deg(const double d) |
| | 96 | const double deg(const double d) |
| 104 | 97 | { |
| 105 | 98 | return d*180.0/boost::math::constants::pi<double>(); |
| 106 | 99 | }; |
| 107 | 100 | |
| 108 | 101 | // convert deg into rad |
| 109 | | double rad(const double d) |
| | 102 | const double rad(const double d) |
| 110 | 103 | { |
| 111 | 104 | return d*boost::math::constants::pi<double>()/180; |
| 112 | 105 | }; |