diff --git a/sprout/algorithm/fit/partition_copy.hpp b/sprout/algorithm/fit/partition_copy.hpp index c9a1f77b..e3a48820 100644 --- a/sprout/algorithm/fit/partition_copy.hpp +++ b/sprout/algorithm/fit/partition_copy.hpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT #include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT diff --git a/sprout/algorithm/fit/set_difference.hpp b/sprout/algorithm/fit/set_difference.hpp index e9d759cb..4be4d0a9 100644 --- a/sprout/algorithm/fit/set_difference.hpp +++ b/sprout/algorithm/fit/set_difference.hpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT @@ -30,7 +30,7 @@ namespace sprout { offset, offset + NS_SSCRISK_CEL_OR_SPROUT::min( NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1) - - sprout::detail::overlap_count_2(first1, last1, first2, last2, comp) + - sprout::detail::set_overlap_count(first1, last1, first2, last2, comp) , sprout::size(result) ) @@ -69,7 +69,7 @@ namespace sprout { offset, offset + NS_SSCRISK_CEL_OR_SPROUT::min( NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1) - - sprout::detail::overlap_count_2(first1, last1, first2, last2) + - sprout::detail::set_overlap_count(first1, last1, first2, last2) , sprout::size(result) ) diff --git a/sprout/algorithm/fit/set_intersection.hpp b/sprout/algorithm/fit/set_intersection.hpp index 9d919fa3..072d3f06 100644 --- a/sprout/algorithm/fit/set_intersection.hpp +++ b/sprout/algorithm/fit/set_intersection.hpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT namespace sprout { @@ -28,7 +28,7 @@ namespace sprout { sprout::get_internal(sprout::fixed::set_intersection(first1, last1, first2, last2, result, comp)), offset, offset + NS_SSCRISK_CEL_OR_SPROUT::min( - sprout::detail::overlap_count_2(first1, last1, first2, last2, comp), + sprout::detail::set_overlap_count(first1, last1, first2, last2, comp), sprout::size(result) ) ); @@ -65,7 +65,7 @@ namespace sprout { sprout::get_internal(sprout::fixed::set_intersection(first1, last1, first2, last2, result)), offset, offset + NS_SSCRISK_CEL_OR_SPROUT::min( - sprout::detail::overlap_count_2(first1, last1, first2, last2), + sprout::detail::set_overlap_count(first1, last1, first2, last2), sprout::size(result) ) ); diff --git a/sprout/algorithm/fit/set_symmetric_difference.hpp b/sprout/algorithm/fit/set_symmetric_difference.hpp index 98fd3468..b564e19a 100644 --- a/sprout/algorithm/fit/set_symmetric_difference.hpp +++ b/sprout/algorithm/fit/set_symmetric_difference.hpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT @@ -31,7 +31,7 @@ namespace sprout { offset + NS_SSCRISK_CEL_OR_SPROUT::min( NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1) + NS_SSCRISK_CEL_OR_SPROUT::distance(first2, last2) - - 2 * sprout::detail::overlap_count_2(first1, last1, first2, last2, comp) + - 2 * sprout::detail::set_overlap_count(first1, last1, first2, last2, comp) , sprout::size(result) ) @@ -71,7 +71,7 @@ namespace sprout { offset + NS_SSCRISK_CEL_OR_SPROUT::min( NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1) + NS_SSCRISK_CEL_OR_SPROUT::distance(first2, last2) - - 2 * sprout::detail::overlap_count_2(first1, last1, first2, last2) + - 2 * sprout::detail::set_overlap_count(first1, last1, first2, last2) , sprout::size(result) ) diff --git a/sprout/algorithm/fit/set_union.hpp b/sprout/algorithm/fit/set_union.hpp index ed9f7448..9d85423b 100644 --- a/sprout/algorithm/fit/set_union.hpp +++ b/sprout/algorithm/fit/set_union.hpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT @@ -31,7 +31,7 @@ namespace sprout { offset + NS_SSCRISK_CEL_OR_SPROUT::min( NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1) + NS_SSCRISK_CEL_OR_SPROUT::distance(first2, last2) - - sprout::detail::overlap_count_2(first1, last1, first2, last2, comp) + - sprout::detail::set_overlap_count(first1, last1, first2, last2, comp) , sprout::size(result) ) @@ -71,7 +71,7 @@ namespace sprout { offset + NS_SSCRISK_CEL_OR_SPROUT::min( NS_SSCRISK_CEL_OR_SPROUT::distance(first1, last1) + NS_SSCRISK_CEL_OR_SPROUT::distance(first2, last2) - - sprout::detail::overlap_count_2(first1, last1, first2, last2) + - sprout::detail::set_overlap_count(first1, last1, first2, last2) , sprout::size(result) ) diff --git a/sprout/detail/algorithm_ext.hpp b/sprout/detail/algorithm_ext.hpp deleted file mode 100644 index 58db22b1..00000000 --- a/sprout/detail/algorithm_ext.hpp +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef SPROUT_DETAIL_ALGORITHM_EXT_HPP -#define SPROUT_DETAIL_ALGORITHM_EXT_HPP - -#include -#include -#include - -namespace sprout { - namespace detail { - // - // count_n - // - template - SPROUT_CONSTEXPR typename std::iterator_traits::difference_type count_n( - InputIterator first, - Size n, - T const& value - ) - { - return n == 0 - ? 0 - : (*first == value ? 1 : 0) + sprout::detail::count_n(sprout::next(first), n - 1, value) - ; - } - - // - // count_n_if - // - template - SPROUT_CONSTEXPR typename std::iterator_traits::difference_type count_n_if( - InputIterator first, - Size n, - Predicate pred - ) - { - return n == 0 - ? 0 - : (pred(*first) ? 1 : 0) + sprout::detail::count_n_if(sprout::next(first), n - 1, pred) - ; - } - } // namespace detail -} // namespace sprout - -#endif // #ifndef SPROUT_DETAIL_ALGORITHM_EXT_HPP diff --git a/sprout/detail/count_n.hpp b/sprout/detail/count_n.hpp new file mode 100644 index 00000000..224719c6 --- /dev/null +++ b/sprout/detail/count_n.hpp @@ -0,0 +1,27 @@ +#ifndef SPROUT_DETAIL_COUNT_N_HPP +#define SPROUT_DETAIL_COUNT_N_HPP + +#include +#include +#include + +namespace sprout { + namespace detail { + // + // count_n + // + template + SPROUT_CONSTEXPR typename std::iterator_traits::difference_type count_n( + InputIterator first, + Size n, + T const& value + ) + { + return n == 0 ? 0 + : (*first == value ? 1 : 0) + sprout::detail::count_n(sprout::next(first), n - 1, value) + ; + } + } // namespace detail +} // namespace sprout + +#endif // #ifndef SPROUT_DETAIL_COUNT_N_HPP diff --git a/sprout/detail/count_n_if.hpp b/sprout/detail/count_n_if.hpp new file mode 100644 index 00000000..9d117a9c --- /dev/null +++ b/sprout/detail/count_n_if.hpp @@ -0,0 +1,27 @@ +#ifndef SPROUT_DETAIL_COUNT_N_IF_HPP +#define SPROUT_DETAIL_COUNT_N_IF_HPP + +#include +#include +#include + +namespace sprout { + namespace detail { + // + // count_n_if + // + template + SPROUT_CONSTEXPR typename std::iterator_traits::difference_type count_n_if( + InputIterator first, + Size n, + Predicate pred + ) + { + return n == 0 ? 0 + : (pred(*first) ? 1 : 0) + sprout::detail::count_n_if(sprout::next(first), n - 1, pred) + ; + } + } // namespace detail +} // namespace sprout + +#endif // #ifndef SPROUT_DETAIL_COUNT_N_IF_HPP diff --git a/sprout/detail/iterator_ext.hpp b/sprout/detail/iterator_ext.hpp deleted file mode 100644 index a9a73af7..00000000 --- a/sprout/detail/iterator_ext.hpp +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef SPROUT_DETAIL_ITERATOR_EXT_HPP -#define SPROUT_DETAIL_ITERATOR_EXT_HPP - -#include -#include -#include - -namespace sprout { - namespace detail { - template - SPROUT_CONSTEXPR typename std::iterator_traits::difference_type bidirectional_distance_impl( - Iterator first1, - Iterator first2, - Iterator last, - typename std::iterator_traits::difference_type current = 1 - ) - { - return first1 == last ? current - : first2 == last ? -current - : sprout::detail::bidirectional_distance_impl(sprout::next(first1), sprout::prev(first2), last, current + 1) - ; - } - - // - // bidirectional_distance - // - template - SPROUT_CONSTEXPR typename std::iterator_traits::difference_type bidirectional_distance( - Iterator first, - Iterator last - ) - { - return first == last ? 0 - : sprout::detail::bidirectional_distance_impl(sprout::next(first), sprout::prev(first), last) - ; - } - } // namespace detail -} // namespace sprout - -#endif // #ifndef SPROUT_DETAIL_ITERATOR_EXT_HPP diff --git a/sprout/detail/overlap_count.hpp b/sprout/detail/overlap_count.hpp index 581f06f0..d926a632 100644 --- a/sprout/detail/overlap_count.hpp +++ b/sprout/detail/overlap_count.hpp @@ -7,12 +7,12 @@ namespace sprout { namespace detail { - template - inline SPROUT_CONSTEXPR typename std::iterator_traits::difference_type overlap_count_impl( - Iterator first, - Iterator last, - typename std::iterator_traits::value_type const& value, - typename std::iterator_traits::difference_type current = 0 + template + inline SPROUT_CONSTEXPR typename std::iterator_traits::difference_type overlap_count_impl( + InputIterator first, + InputIterator last, + typename std::iterator_traits::value_type const& value, + typename std::iterator_traits::difference_type current = 0 ) { return first == last @@ -25,10 +25,10 @@ namespace sprout { // // overlap_count // - template - inline SPROUT_CONSTEXPR typename std::iterator_traits::difference_type overlap_count( - Iterator first, - Iterator last + template + inline SPROUT_CONSTEXPR typename std::iterator_traits::difference_type overlap_count( + InputIterator first, + InputIterator last ) { return first == last @@ -37,12 +37,12 @@ namespace sprout { ; } - template - inline SPROUT_CONSTEXPR typename std::iterator_traits::difference_type overlap_count_impl( - Iterator first, - Iterator last, + template + inline SPROUT_CONSTEXPR typename std::iterator_traits::difference_type overlap_count_impl( + InputIterator first, + InputIterator last, Predicate pred, - typename std::iterator_traits::value_type const& value + typename std::iterator_traits::value_type const& value ) { return first == last @@ -55,10 +55,10 @@ namespace sprout { // // overlap_count // - template - inline SPROUT_CONSTEXPR typename std::iterator_traits::difference_type overlap_count( - Iterator first, - Iterator last, + template + inline SPROUT_CONSTEXPR typename std::iterator_traits::difference_type overlap_count( + InputIterator first, + InputIterator last, Predicate pred ) { diff --git a/sprout/detail/overlap_count_2.hpp b/sprout/detail/overlap_count_2.hpp deleted file mode 100644 index 3d855ca6..00000000 --- a/sprout/detail/overlap_count_2.hpp +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef SPROUT_DETAIL_OVERLAP_COUNT_2_HPP -#define SPROUT_DETAIL_OVERLAP_COUNT_2_HPP - -#include -#include -#include - -namespace sprout { - namespace detail { - // - // overlap_count_2 - // - template - inline SPROUT_CONSTEXPR typename std::iterator_traits::difference_type overlap_count_2( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, - Compare comp - ) - { - return first1 != last1 && first2 != last2 - ? comp(*first1, *first2) - ? sprout::detail::overlap_count_2(sprout::next(first1), last1, first2, last2, comp) - : comp(*first2, *first1) - ? sprout::detail::overlap_count_2(first1, last1, sprout::next(first2), last2, comp) - : 1 + sprout::detail::overlap_count_2(sprout::next(first1), last1, sprout::next(first2), last2, comp) - : 0 - ; - } - // - // overlap_count_2 - // - template - inline SPROUT_CONSTEXPR typename std::iterator_traits::difference_type overlap_count_2( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2 - ) - { - return first1 != last1 && first2 != last2 - ? *first1 < *first2 - ? sprout::detail::overlap_count_2(sprout::next(first1), last1, first2, last2) - : *first2 < *first1 - ? sprout::detail::overlap_count_2(first1, last1, sprout::next(first2), last2) - : 1 + sprout::detail::overlap_count_2(sprout::next(first1), last1, sprout::next(first2), last2) - : 0 - ; - } - } // namespace detail -} // namespace sprout - -#endif // #ifndef SPROUT_DETAIL_OVERLAP_COUNT_2_HPP diff --git a/sprout/detail/set_overlap_count.hpp b/sprout/detail/set_overlap_count.hpp new file mode 100644 index 00000000..29553809 --- /dev/null +++ b/sprout/detail/set_overlap_count.hpp @@ -0,0 +1,54 @@ +#ifndef SPROUT_DETAIL_SET_OVERLAP_COUNT_HPP +#define SPROUT_DETAIL_SET_OVERLAP_COUNT_HPP + +#include +#include +#include + +namespace sprout { + namespace detail { + // + // set_overlap_count + // + template + inline SPROUT_CONSTEXPR typename std::iterator_traits::difference_type set_overlap_count( + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + Compare comp + ) + { + return first1 != last1 && first2 != last2 + ? comp(*first1, *first2) + ? sprout::detail::set_overlap_count(sprout::next(first1), last1, first2, last2, comp) + : comp(*first2, *first1) + ? sprout::detail::set_overlap_count(first1, last1, sprout::next(first2), last2, comp) + : 1 + sprout::detail::set_overlap_count(sprout::next(first1), last1, sprout::next(first2), last2, comp) + : 0 + ; + } + // + // set_overlap_count + // + template + inline SPROUT_CONSTEXPR typename std::iterator_traits::difference_type set_overlap_count( + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2 + ) + { + return first1 != last1 && first2 != last2 + ? *first1 < *first2 + ? sprout::detail::set_overlap_count(sprout::next(first1), last1, first2, last2) + : *first2 < *first1 + ? sprout::detail::set_overlap_count(first1, last1, sprout::next(first2), last2) + : 1 + sprout::detail::set_overlap_count(sprout::next(first1), last1, sprout::next(first2), last2) + : 0 + ; + } + } // namespace detail +} // namespace sprout + +#endif // #ifndef SPROUT_DETAIL_SET_OVERLAP_COUNT_HPP diff --git a/sprout/math/abs.hpp b/sprout/math/abs.hpp index 4a96e1e6..af8aee66 100644 --- a/sprout/math/abs.hpp +++ b/sprout/math/abs.hpp @@ -4,9 +4,7 @@ #include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif +#include namespace sprout { namespace math { @@ -27,12 +25,7 @@ namespace sprout { > inline SPROUT_CONSTEXPR FloatType abs(FloatType x) { -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::abs; -# else - using sprout::math::detail::abs; -# endif - return abs(x); + return NS_SPROUT_MATH_DETAIL::abs(x); } } // namespace math diff --git a/sprout/math/acos.hpp b/sprout/math/acos.hpp index 92114d25..c0b7d5c4 100644 --- a/sprout/math/acos.hpp +++ b/sprout/math/acos.hpp @@ -3,12 +3,10 @@ #include #include +#include #include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -32,11 +30,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::acos; -# else - using sprout::math::detail::acos; -# endif + using NS_SPROUT_MATH_DETAIL::acos; } // namespace math using sprout::math::acos; diff --git a/sprout/math/acosh.hpp b/sprout/math/acosh.hpp index 55eedad9..5f6996a2 100644 --- a/sprout/math/acosh.hpp +++ b/sprout/math/acosh.hpp @@ -4,12 +4,10 @@ #include #include #include +#include #include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -36,11 +34,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::acosh; -# else - using sprout::math::detail::acosh; -# endif + using NS_SPROUT_MATH_DETAIL::acosh; } // namespace math using sprout::math::acosh; diff --git a/sprout/math/asin.hpp b/sprout/math/asin.hpp index 15b97f26..7c426ba6 100644 --- a/sprout/math/asin.hpp +++ b/sprout/math/asin.hpp @@ -5,13 +5,11 @@ #include #include #include +#include #include #include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -75,11 +73,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::asin; -# else - using sprout::math::detail::asin; -# endif + using NS_SPROUT_MATH_DETAIL::asin; } // namespace math using sprout::math::asin; diff --git a/sprout/math/asinh.hpp b/sprout/math/asinh.hpp index 2221c036..e86d1367 100644 --- a/sprout/math/asinh.hpp +++ b/sprout/math/asinh.hpp @@ -4,12 +4,10 @@ #include #include #include +#include #include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -36,11 +34,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::asinh; -# else - using sprout::math::detail::asinh; -# endif + using NS_SPROUT_MATH_DETAIL::asinh; } // namespace math using sprout::math::asinh; diff --git a/sprout/math/atan.hpp b/sprout/math/atan.hpp index fd23eb6d..9a5893ad 100644 --- a/sprout/math/atan.hpp +++ b/sprout/math/atan.hpp @@ -4,12 +4,10 @@ #include #include #include +#include #include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -70,11 +68,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::atan; -# else - using sprout::math::detail::atan; -# endif + using NS_SPROUT_MATH_DETAIL::atan; } // namespace math using sprout::math::atan; diff --git a/sprout/math/atan2.hpp b/sprout/math/atan2.hpp index 2b7abea3..7e15766f 100644 --- a/sprout/math/atan2.hpp +++ b/sprout/math/atan2.hpp @@ -3,13 +3,11 @@ #include #include +#include #include #include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -40,11 +38,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::atan2; -# else - using sprout::math::detail::atan2; -# endif + using NS_SPROUT_MATH_DETAIL::atan2; } // namespace math using sprout::math::atan2; diff --git a/sprout/math/atanh.hpp b/sprout/math/atanh.hpp index 88434e4a..28737df9 100644 --- a/sprout/math/atanh.hpp +++ b/sprout/math/atanh.hpp @@ -4,11 +4,9 @@ #include #include #include +#include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -36,11 +34,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::atanh; -# else - using sprout::math::detail::atanh; -# endif + using NS_SPROUT_MATH_DETAIL::atanh; } // namespace math using sprout::math::atanh; diff --git a/sprout/math/cbrt.hpp b/sprout/math/cbrt.hpp index 3258d07c..48963c54 100644 --- a/sprout/math/cbrt.hpp +++ b/sprout/math/cbrt.hpp @@ -3,12 +3,10 @@ #include #include +#include #include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -34,11 +32,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::cbrt; -# else - using sprout::math::detail::cbrt; -# endif + using NS_SPROUT_MATH_DETAIL::cbrt; } // namespace math using sprout::math::cbrt; diff --git a/sprout/math/cos.hpp b/sprout/math/cos.hpp index de57be78..93579abe 100644 --- a/sprout/math/cos.hpp +++ b/sprout/math/cos.hpp @@ -5,11 +5,9 @@ #include #include #include +#include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -56,11 +54,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::cos; -# else - using sprout::math::detail::cos; -# endif + using NS_SPROUT_MATH_DETAIL::cos; } // namespace math using sprout::math::cos; diff --git a/sprout/math/cosh.hpp b/sprout/math/cosh.hpp index bd665708..31b31608 100644 --- a/sprout/math/cosh.hpp +++ b/sprout/math/cosh.hpp @@ -4,11 +4,9 @@ #include #include #include +#include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -51,11 +49,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::cosh; -# else - using sprout::math::detail::cosh; -# endif + using NS_SPROUT_MATH_DETAIL::cosh; } // namespace math using sprout::math::cosh; diff --git a/sprout/math/detail/config.hpp b/sprout/math/detail/config.hpp new file mode 100644 index 00000000..7ad9d474 --- /dev/null +++ b/sprout/math/detail/config.hpp @@ -0,0 +1,15 @@ +#ifndef SPROUT_MATH_DETAIL_CONFIG_HPP +#define SPROUT_MATH_DETAIL_CONFIG_HPP + +#include +#if SPROUT_USE_BUILTIN_CMATH_FUNCTION +# include +#endif + +#if SPROUT_USE_BUILTIN_CMATH_FUNCTION +# define NS_SPROUT_MATH_DETAIL std +#else // #ifndef SPROUT_USE_BUILTIN_CMATH_FUNCTION +# define NS_SPROUT_MATH_DETAIL sprout::math::detail +#endif // #ifndef SPROUT_USE_BUILTIN_CMATH_FUNCTION + +#endif // #ifndef SPROUT_MATH_DETAIL_CONFIG_HPP diff --git a/sprout/math/exp.hpp b/sprout/math/exp.hpp index 79d2f623..a529b012 100644 --- a/sprout/math/exp.hpp +++ b/sprout/math/exp.hpp @@ -4,11 +4,9 @@ #include #include #include +#include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -51,11 +49,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::exp; -# else - using sprout::math::detail::exp; -# endif + using NS_SPROUT_MATH_DETAIL::exp; } // namespace math using sprout::math::exp; diff --git a/sprout/math/exp2.hpp b/sprout/math/exp2.hpp index 7d39385f..72fbcd3e 100644 --- a/sprout/math/exp2.hpp +++ b/sprout/math/exp2.hpp @@ -3,12 +3,10 @@ #include #include +#include #include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -32,11 +30,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::exp2; -# else - using sprout::math::detail::exp2; -# endif + using NS_SPROUT_MATH_DETAIL::exp2; } // namespace math using sprout::math::exp2; diff --git a/sprout/math/expm1.hpp b/sprout/math/expm1.hpp index 11c5561c..cccbde77 100644 --- a/sprout/math/expm1.hpp +++ b/sprout/math/expm1.hpp @@ -3,12 +3,10 @@ #include #include +#include #include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -32,11 +30,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::expm1; -# else - using sprout::math::detail::expm1; -# endif + using NS_SPROUT_MATH_DETAIL::expm1; } // namespace math using sprout::math::expm1; diff --git a/sprout/math/fabs.hpp b/sprout/math/fabs.hpp index 920cc017..b6792cff 100644 --- a/sprout/math/fabs.hpp +++ b/sprout/math/fabs.hpp @@ -3,10 +3,8 @@ #include #include +#include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -30,11 +28,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::fabs; -# else - using sprout::math::detail::fabs; -# endif + using NS_SPROUT_MATH_DETAIL::fabs; } // namespace math using sprout::math::fabs; diff --git a/sprout/math/fdim.hpp b/sprout/math/fdim.hpp index f28ecd23..05da8798 100644 --- a/sprout/math/fdim.hpp +++ b/sprout/math/fdim.hpp @@ -3,11 +3,9 @@ #include #include +#include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -35,11 +33,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::fdim; -# else - using sprout::math::detail::fdim; -# endif + using NS_SPROUT_MATH_DETAIL::fdim; } // namespace math using sprout::math::fdim; diff --git a/sprout/math/fma.hpp b/sprout/math/fma.hpp index fe6a2364..53eb990e 100644 --- a/sprout/math/fma.hpp +++ b/sprout/math/fma.hpp @@ -3,11 +3,9 @@ #include #include +#include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -42,11 +40,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::fma; -# else - using sprout::math::detail::fma; -# endif + using NS_SPROUT_MATH_DETAIL::fma; } // namespace math using sprout::math::fma; diff --git a/sprout/math/fmax.hpp b/sprout/math/fmax.hpp index 92baed63..1e3faa5e 100644 --- a/sprout/math/fmax.hpp +++ b/sprout/math/fmax.hpp @@ -3,11 +3,9 @@ #include #include +#include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -35,11 +33,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::fmax; -# else - using sprout::math::detail::fmax; -# endif + using NS_SPROUT_MATH_DETAIL::fmax; } // namespace math using sprout::math::fmax; diff --git a/sprout/math/fmin.hpp b/sprout/math/fmin.hpp index 3b053f52..85f52476 100644 --- a/sprout/math/fmin.hpp +++ b/sprout/math/fmin.hpp @@ -3,11 +3,9 @@ #include #include +#include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -35,11 +33,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::fmin; -# else - using sprout::math::detail::fmin; -# endif + using NS_SPROUT_MATH_DETAIL::fmin; } // namespace math using sprout::math::fmin; diff --git a/sprout/math/fpclassify.hpp b/sprout/math/fpclassify.hpp index 0f073f4f..466897c7 100644 --- a/sprout/math/fpclassify.hpp +++ b/sprout/math/fpclassify.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -28,11 +29,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::fpclassify; -# else - using sprout::math::detail::fpclassify; -# endif + using NS_SPROUT_MATH_DETAIL::fpclassify; } // namespace math using sprout::math::fpclassify; diff --git a/sprout/math/hypot.hpp b/sprout/math/hypot.hpp index d463484b..0068166f 100644 --- a/sprout/math/hypot.hpp +++ b/sprout/math/hypot.hpp @@ -3,12 +3,10 @@ #include #include +#include #include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -36,11 +34,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::hypot; -# else - using sprout::math::detail::hypot; -# endif + using NS_SPROUT_MATH_DETAIL::hypot; } // namespace math using sprout::math::hypot; diff --git a/sprout/math/isfinite.hpp b/sprout/math/isfinite.hpp index 8eff3f7f..0228ce8e 100644 --- a/sprout/math/isfinite.hpp +++ b/sprout/math/isfinite.hpp @@ -4,11 +4,9 @@ #include #include #include +#include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -25,11 +23,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::isfinite; -# else - using sprout::math::detail::isfinite; -# endif + using NS_SPROUT_MATH_DETAIL::isfinite; } // namespace math using sprout::math::isfinite; diff --git a/sprout/math/isinf.hpp b/sprout/math/isinf.hpp index ef5daaeb..de6f7d87 100644 --- a/sprout/math/isinf.hpp +++ b/sprout/math/isinf.hpp @@ -4,10 +4,8 @@ #include #include #include +#include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -24,11 +22,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::isinf; -# else - using sprout::math::detail::isinf; -# endif + using NS_SPROUT_MATH_DETAIL::isinf; } // namespace math using sprout::math::isinf; diff --git a/sprout/math/isnan.hpp b/sprout/math/isnan.hpp index 15fa91e4..892f9f71 100644 --- a/sprout/math/isnan.hpp +++ b/sprout/math/isnan.hpp @@ -3,10 +3,8 @@ #include #include +#include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -21,11 +19,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::isnan; -# else - using sprout::math::detail::isnan; -# endif + using NS_SPROUT_MATH_DETAIL::isnan; } // namespace math using sprout::math::isnan; diff --git a/sprout/math/isnormal.hpp b/sprout/math/isnormal.hpp index c00cc755..315674c7 100644 --- a/sprout/math/isnormal.hpp +++ b/sprout/math/isnormal.hpp @@ -4,12 +4,10 @@ #include #include #include +#include #include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -27,11 +25,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::isnormal; -# else - using sprout::math::detail::isnormal; -# endif + using NS_SPROUT_MATH_DETAIL::isnormal; } // namespace math using sprout::math::isnormal; diff --git a/sprout/math/log.hpp b/sprout/math/log.hpp index 989b3d4c..2c4ead9c 100644 --- a/sprout/math/log.hpp +++ b/sprout/math/log.hpp @@ -5,13 +5,11 @@ #include #include #include +#include #include #include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -69,11 +67,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::log; -# else - using sprout::math::detail::log; -# endif + using NS_SPROUT_MATH_DETAIL::log; } // namespace math using sprout::math::log; diff --git a/sprout/math/log10.hpp b/sprout/math/log10.hpp index 8d76c27d..bfb98933 100644 --- a/sprout/math/log10.hpp +++ b/sprout/math/log10.hpp @@ -3,12 +3,10 @@ #include #include +#include #include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -32,11 +30,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::log10; -# else - using sprout::math::detail::log10; -# endif + using NS_SPROUT_MATH_DETAIL::log10; } // namespace math using sprout::math::log10; diff --git a/sprout/math/log1p.hpp b/sprout/math/log1p.hpp index ee4db6ea..605f6dd9 100644 --- a/sprout/math/log1p.hpp +++ b/sprout/math/log1p.hpp @@ -3,11 +3,9 @@ #include #include +#include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -31,11 +29,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::log1p; -# else - using sprout::math::detail::log1p; -# endif + using NS_SPROUT_MATH_DETAIL::log1p; } // namespace math using sprout::math::log1p; diff --git a/sprout/math/log2.hpp b/sprout/math/log2.hpp index fa38104f..59770748 100644 --- a/sprout/math/log2.hpp +++ b/sprout/math/log2.hpp @@ -3,12 +3,10 @@ #include #include +#include #include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -32,11 +30,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::log2; -# else - using sprout::math::detail::log2; -# endif + using NS_SPROUT_MATH_DETAIL::log2; } // namespace math using sprout::math::log2; diff --git a/sprout/math/pow.hpp b/sprout/math/pow.hpp index d94bb7fe..1894b323 100644 --- a/sprout/math/pow.hpp +++ b/sprout/math/pow.hpp @@ -3,14 +3,12 @@ #include #include +#include #include #include #include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -40,11 +38,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::pow; -# else - using sprout::math::detail::pow; -# endif + using NS_SPROUT_MATH_DETAIL::pow; } // namespace math using sprout::math::pow; diff --git a/sprout/math/signbit.hpp b/sprout/math/signbit.hpp index ea8e83cf..2aa980fa 100644 --- a/sprout/math/signbit.hpp +++ b/sprout/math/signbit.hpp @@ -3,10 +3,8 @@ #include #include +#include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -21,11 +19,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::signbit; -# else - using sprout::math::detail::signbit; -# endif + using NS_SPROUT_MATH_DETAIL::signbit; } // namespace math using sprout::math::signbit; diff --git a/sprout/math/sin.hpp b/sprout/math/sin.hpp index 950c40df..e145807f 100644 --- a/sprout/math/sin.hpp +++ b/sprout/math/sin.hpp @@ -3,12 +3,10 @@ #include #include +#include #include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -32,11 +30,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::sin; -# else - using sprout::math::detail::sin; -# endif + using NS_SPROUT_MATH_DETAIL::sin; } // namespace math using sprout::math::sin; diff --git a/sprout/math/sinh.hpp b/sprout/math/sinh.hpp index 25bacda9..4f276584 100644 --- a/sprout/math/sinh.hpp +++ b/sprout/math/sinh.hpp @@ -4,11 +4,9 @@ #include #include #include +#include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -51,11 +49,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::sinh; -# else - using sprout::math::detail::sinh; -# endif + using NS_SPROUT_MATH_DETAIL::sinh; } // namespace math using sprout::math::sinh; diff --git a/sprout/math/sqrt.hpp b/sprout/math/sqrt.hpp index 87181b18..1d67a91e 100644 --- a/sprout/math/sqrt.hpp +++ b/sprout/math/sqrt.hpp @@ -4,10 +4,8 @@ #include #include #include +#include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -59,11 +57,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::sqrt; -# else - using sprout::math::detail::sqrt; -# endif + using NS_SPROUT_MATH_DETAIL::sqrt; } // namespace math using sprout::math::sqrt; diff --git a/sprout/math/tan.hpp b/sprout/math/tan.hpp index e2a42cfe..198be179 100644 --- a/sprout/math/tan.hpp +++ b/sprout/math/tan.hpp @@ -3,12 +3,10 @@ #include #include +#include #include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -32,11 +30,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::tan; -# else - using sprout::math::detail::tan; -# endif + using NS_SPROUT_MATH_DETAIL::tan; } // namespace math using sprout::math::tan; diff --git a/sprout/math/tanh.hpp b/sprout/math/tanh.hpp index 84f393c2..918e7975 100644 --- a/sprout/math/tanh.hpp +++ b/sprout/math/tanh.hpp @@ -3,12 +3,10 @@ #include #include +#include #include #include #include -#if SPROUT_USE_BUILTIN_CMATH_FUNCTION -# include -#endif namespace sprout { namespace math { @@ -32,11 +30,7 @@ namespace sprout { } } // namespace detail -# if SPROUT_USE_BUILTIN_CMATH_FUNCTION - using std::tanh; -# else - using sprout::math::detail::tanh; -# endif + using NS_SPROUT_MATH_DETAIL::tanh; } // namespace math using sprout::math::tanh;