From 89ec0c69f85cfed13e272d22360d7d8c3fafa548 Mon Sep 17 00:00:00 2001 From: Robert Ramey Date: Fri, 15 Jan 2016 17:02:51 -0800 Subject: [PATCH] eliminated dependence upon boost/mpl/or_.hpp --- include/safe_base_operations.hpp | 218 ++++++++++++++----------------- 1 file changed, 96 insertions(+), 122 deletions(-) diff --git a/include/safe_base_operations.hpp b/include/safe_base_operations.hpp index 25cfb67..126daab 100644 --- a/include/safe_base_operations.hpp +++ b/include/safe_base_operations.hpp @@ -19,8 +19,6 @@ #include #include -#include -#include #include #include // lazy_enable_if @@ -323,11 +321,10 @@ struct addition_result { }; template -typename boost::lazy_enable_if< - boost::mpl::or_< - boost::numeric::is_safe, - boost::numeric::is_safe - >, +typename boost::lazy_enable_if_c< + boost::numeric::is_safe::value + || boost::numeric::is_safe::value + , addition_result >::type constexpr inline operator+(const T & t, const U & u){ @@ -344,11 +341,10 @@ constexpr inline operator+(const T & t, const U & u){ } template -typename boost::lazy_enable_if< - boost::mpl::or_< - boost::numeric::is_safe, - boost::numeric::is_safe - >, +typename boost::lazy_enable_if_c< + boost::numeric::is_safe::value + || boost::numeric::is_safe::value + , boost::mpl::identity >::type constexpr inline operator+=(T & t, const U & u){ @@ -430,11 +426,10 @@ struct subtraction_result { }; template -typename boost::lazy_enable_if< - boost::mpl::or_< - boost::numeric::is_safe, - boost::numeric::is_safe - >, +typename boost::lazy_enable_if_c< + boost::numeric::is_safe::value + || boost::numeric::is_safe::value + , subtraction_result >::type constexpr operator-(const T & t, const U & u){ @@ -450,11 +445,10 @@ constexpr operator-(const T & t, const U & u){ } template -typename boost::lazy_enable_if< - boost::mpl::or_< - boost::numeric::is_safe, - boost::numeric::is_safe - >, +typename boost::lazy_enable_if_c< + boost::numeric::is_safe::value + || boost::numeric::is_safe::value + , boost::mpl::identity >::type constexpr inline operator-=(T & t, const U & u){ @@ -545,11 +539,10 @@ struct multiplication_result { }; template -typename boost::lazy_enable_if< - boost::mpl::or_< - boost::numeric::is_safe, - boost::numeric::is_safe - >, +typename boost::lazy_enable_if_c< + boost::numeric::is_safe::value + || boost::numeric::is_safe::value + , multiplication_result >::type constexpr operator*(const T & t, const U & u){ @@ -566,11 +559,10 @@ constexpr operator*(const T & t, const U & u){ } template -typename boost::lazy_enable_if< - boost::mpl::or_< - boost::numeric::is_safe, - boost::numeric::is_safe - >, +typename boost::lazy_enable_if_c< + boost::numeric::is_safe::value + || boost::numeric::is_safe::value + , boost::mpl::identity >::type constexpr inline operator*=(T & t, const U & u){ @@ -657,11 +649,10 @@ struct division_result { }; template -typename boost::lazy_enable_if< - boost::mpl::or_< - boost::numeric::is_safe, - boost::numeric::is_safe - >, +typename boost::lazy_enable_if_c< + boost::numeric::is_safe::value + || boost::numeric::is_safe::value + , division_result >::type constexpr operator/(const T & t, const U & u){ @@ -678,11 +669,10 @@ constexpr operator/(const T & t, const U & u){ } template -typename boost::lazy_enable_if< - boost::mpl::or_< - boost::numeric::is_safe, - boost::numeric::is_safe - >, +typename boost::lazy_enable_if_c< + boost::numeric::is_safe::value + || boost::numeric::is_safe::value + , boost::mpl::identity >::type constexpr inline operator/=(T & t, const U & u){ @@ -768,11 +758,10 @@ struct modulus_result { }; template -typename boost::lazy_enable_if< - boost::mpl::or_< - boost::numeric::is_safe, - boost::numeric::is_safe - >, +typename boost::lazy_enable_if_c< + boost::numeric::is_safe::value + || boost::numeric::is_safe::value + , modulus_result >::type inline operator%(const T & t, const U & u){ @@ -788,11 +777,10 @@ inline operator%(const T & t, const U & u){ } template -typename boost::lazy_enable_if< - boost::mpl::or_< - boost::numeric::is_safe, - boost::numeric::is_safe - >, +typename boost::lazy_enable_if_c< + boost::numeric::is_safe::value + || boost::numeric::is_safe::value + , boost::mpl::identity >::type constexpr inline operator%=(T & t, const U & u){ @@ -804,11 +792,10 @@ constexpr inline operator%=(T & t, const U & u){ // comparison template -typename boost::lazy_enable_if< - boost::mpl::or_< - boost::numeric::is_safe, - boost::numeric::is_safe - >, +typename boost::lazy_enable_if_c< + boost::numeric::is_safe::value + || boost::numeric::is_safe::value + , boost::mpl::identity >::type constexpr operator<(const T & lhs, const U & rhs) { @@ -841,11 +828,10 @@ constexpr operator<(const T & lhs, const U & rhs) { } template -typename boost::lazy_enable_if< - boost::mpl::or_< - boost::numeric::is_safe, - boost::numeric::is_safe - >, +typename boost::lazy_enable_if_c< + boost::numeric::is_safe::value + || boost::numeric::is_safe::value + , boost::mpl::identity >::type constexpr operator>(const T & lhs, const U & rhs) { @@ -877,11 +863,10 @@ constexpr operator>(const T & lhs, const U & rhs) { } template -typename boost::lazy_enable_if< - boost::mpl::or_< - boost::numeric::is_safe, - boost::numeric::is_safe - >, +typename boost::lazy_enable_if_c< + boost::numeric::is_safe::value + || boost::numeric::is_safe::value + , boost::mpl::identity >::type constexpr operator==(const T & lhs, const U & rhs) { @@ -910,11 +895,10 @@ constexpr operator==(const T & lhs, const U & rhs) { } template -typename boost::lazy_enable_if< - boost::mpl::or_< - boost::numeric::is_safe, - boost::numeric::is_safe - >, +typename boost::lazy_enable_if_c< + boost::numeric::is_safe::value + || boost::numeric::is_safe::value + , boost::mpl::identity >::type constexpr operator!=(const T & lhs, const U & rhs) { @@ -922,11 +906,10 @@ constexpr operator!=(const T & lhs, const U & rhs) { } template -typename boost::lazy_enable_if< - boost::mpl::or_< - boost::numeric::is_safe, - boost::numeric::is_safe - >, +typename boost::lazy_enable_if_c< + boost::numeric::is_safe::value + || boost::numeric::is_safe::value + , boost::mpl::identity >::type constexpr operator>=(const T & lhs, const U & rhs) { @@ -934,11 +917,10 @@ constexpr operator>=(const T & lhs, const U & rhs) { } template -typename boost::lazy_enable_if< - boost::mpl::or_< - boost::numeric::is_safe, - boost::numeric::is_safe - >, +typename boost::lazy_enable_if_c< + boost::numeric::is_safe::value + || boost::numeric::is_safe::value + , boost::mpl::identity >::type constexpr operator<=(const T & lhs, const U & rhs) { @@ -1043,11 +1025,10 @@ constexpr inline operator<<(const T & t, const U & u){ } template -typename boost::lazy_enable_if< - boost::mpl::or_< - boost::numeric::is_safe, - boost::numeric::is_safe - >, +typename boost::lazy_enable_if_c< + boost::numeric::is_safe::value + || boost::numeric::is_safe::value + , boost::mpl::identity >::type constexpr inline operator<<=(T & t, const U & u){ @@ -1150,11 +1131,10 @@ constexpr inline operator>>(const T & t, const U & u){ } template -typename boost::lazy_enable_if< - boost::mpl::or_< - boost::numeric::is_safe, - boost::numeric::is_safe - >, +typename boost::lazy_enable_if_c< + boost::numeric::is_safe::value + || boost::numeric::is_safe::value + , boost::mpl::identity >::type constexpr inline operator>>=(T & t, const U & u){ @@ -1199,11 +1179,10 @@ struct bitwise_or_result { }; template -typename boost::lazy_enable_if< - boost::mpl::or_< - boost::numeric::is_safe, - boost::numeric::is_safe - >, +typename boost::lazy_enable_if_c< + boost::numeric::is_safe::value + || boost::numeric::is_safe::value + , bitwise_or_result >::type constexpr inline operator|(const T & t, const U & u){ @@ -1224,11 +1203,10 @@ constexpr inline operator|(const T & t, const U & u){ } template -typename boost::lazy_enable_if< - boost::mpl::or_< - boost::numeric::is_safe, - boost::numeric::is_safe - >, +typename boost::lazy_enable_if_c< + boost::numeric::is_safe::value + || boost::numeric::is_safe::value + , boost::mpl::identity >::type constexpr inline operator|=(T & t, const U & u){ @@ -1270,11 +1248,10 @@ struct bitwise_and_result { }; template -typename boost::lazy_enable_if< - boost::mpl::or_< - boost::numeric::is_safe, - boost::numeric::is_safe - >, +typename boost::lazy_enable_if_c< + boost::numeric::is_safe::value + || boost::numeric::is_safe::value + , bitwise_and_result >::type constexpr inline operator&(const T & t, const U & u){ @@ -1295,11 +1272,10 @@ constexpr inline operator&(const T & t, const U & u){ } template -typename boost::lazy_enable_if< - boost::mpl::or_< - boost::numeric::is_safe, - boost::numeric::is_safe - >, +typename boost::lazy_enable_if_c< + boost::numeric::is_safe::value + || boost::numeric::is_safe::value + , boost::mpl::identity >::type constexpr inline operator&=(T & t, const U & u){ @@ -1309,11 +1285,10 @@ constexpr inline operator&=(T & t, const U & u){ // operator ^ template -typename boost::lazy_enable_if< - boost::mpl::or_< - boost::numeric::is_safe, - boost::numeric::is_safe - >, +typename boost::lazy_enable_if_c< + boost::numeric::is_safe::value + || boost::numeric::is_safe::value + , bitwise_or_result >::type constexpr inline operator^(const T & t, const U & u){ @@ -1331,11 +1306,10 @@ constexpr inline operator^(const T & t, const U & u){ } template -typename boost::lazy_enable_if< - boost::mpl::or_< - boost::numeric::is_safe, - boost::numeric::is_safe - >, +typename boost::lazy_enable_if_c< + boost::numeric::is_safe::value + || boost::numeric::is_safe::value + , boost::mpl::identity >::type constexpr inline operator^=(T & t, const U & u){