add boost on mac
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
#ifndef BOOST_NUMERIC_CONCEPT_EXCEPTION_POLICY_HPP
|
||||
#define BOOST_NUMERIC_CONCEPT_EXCEPTION_POLICY_HPP
|
||||
|
||||
// Copyright (c) 2015 Robert Ramey
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
namespace boost {
|
||||
namespace safe_numerics {
|
||||
|
||||
template<class EP>
|
||||
struct ExceptionPolicy {
|
||||
const char * message;
|
||||
/*
|
||||
BOOST_CONCEPT_USAGE(ExceptionPolicy){
|
||||
EP::on_arithmetic_error(e, message);
|
||||
EP::on_undefined_behavior(e, message)
|
||||
EP::on_implementation_defined_behavior(e, message)
|
||||
EP::on_uninitialized_value(e, message)
|
||||
}
|
||||
*/
|
||||
};
|
||||
|
||||
} // safe_numerics
|
||||
} // boost
|
||||
|
||||
#endif // BOOST_NUMERIC_CONCEPT_EXCEPTION_POLICY_HPP
|
||||
27
macx64/include/boost/safe_numerics/concept/integer.hpp
Normal file
27
macx64/include/boost/safe_numerics/concept/integer.hpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef BOOST_NUMERIC_CONCEPT_INTEGER_HPP
|
||||
#define BOOST_NUMERIC_CONCEPT_INTEGER_HPP
|
||||
|
||||
// Copyright (c) 2012 Robert Ramey
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "numeric.hpp"
|
||||
|
||||
namespace boost {
|
||||
namespace safe_numerics {
|
||||
|
||||
template <class T>
|
||||
class Integer : public Numeric<T> {
|
||||
// integer types must have the corresponding numeric trait.
|
||||
static_assert(
|
||||
std::numeric_limits<T>::is_integer,
|
||||
"Fails to fulfill requirements for an integer type"
|
||||
);
|
||||
};
|
||||
|
||||
} // safe_numerics
|
||||
} // boost
|
||||
|
||||
#endif // BOOST_NUMERIC_CONCEPT_INTEGER_HPP
|
||||
29
macx64/include/boost/safe_numerics/concept/numeric.hpp
Normal file
29
macx64/include/boost/safe_numerics/concept/numeric.hpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef BOOST_NUMERIC_CONCEPT_NUMERIC_HPP
|
||||
#define BOOST_NUMERIC_CONCEPT_NUMERIC_HPP
|
||||
|
||||
// Copyright (c) 2012 Robert Ramey
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace boost {
|
||||
namespace safe_numerics {
|
||||
|
||||
template<class T>
|
||||
struct Numeric {
|
||||
// if your program traps here, you need to create a
|
||||
// std::numeric_limits class for your type T. see
|
||||
// see C++ standard 18.3.2.2
|
||||
static_assert(
|
||||
std::numeric_limits<T>::is_specialized,
|
||||
"std::numeric_limits<T> has not been specialized for this type"
|
||||
);
|
||||
};
|
||||
|
||||
} // safe_numerics
|
||||
} // boost
|
||||
|
||||
#endif // BOOST_NUMERIC_CONCEPT_NUMERIC_HPP
|
||||
@@ -0,0 +1,33 @@
|
||||
#ifndef BOOST_NUMERIC_CONCEPT_PROMOTION_POLICY_HPP
|
||||
#define BOOST_NUMERIC_CONCEPT_PROMOTION_POLICY_HPP
|
||||
|
||||
// Copyright (c) 2015 Robert Ramey
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
namespace boost {
|
||||
namespace safe_numerics {
|
||||
|
||||
template<class PP>
|
||||
struct PromotionPolicy {
|
||||
using T = int;
|
||||
using U = int;
|
||||
using a_type = typename PP::template addition_result<T, U>;
|
||||
using s_type = typename PP::template subtraction_result<T, U>;
|
||||
using m_type = typename PP::template multiplication_result<T, U>;
|
||||
using d_type = typename PP::template division_result<T, U>;
|
||||
using mod_type = typename PP::template modulus_result<T, U>;
|
||||
using ls_type = typename PP::template left_shift_result<T, U>;
|
||||
using rs_type = typename PP::template right_shift_result<T, U>;
|
||||
using cc_type = typename PP::template comparison_result<T, U>;
|
||||
using baw_type = typename PP::template bitwise_and_result<T, U>;
|
||||
using bow_type = typename PP::template bitwise_or_result<T, U>;
|
||||
using bxw_type = typename PP::template bitwise_xor_result<T, U>;
|
||||
};
|
||||
|
||||
} // safe_numerics
|
||||
} // boost
|
||||
|
||||
#endif // BOOST_NUMERIC_CONCEPT_EXCEPTION_POLICY_HPP
|
||||
34
macx64/include/boost/safe_numerics/concept/safe_numeric.hpp
Normal file
34
macx64/include/boost/safe_numerics/concept/safe_numeric.hpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef BOOST_NUMERIC_CONCEPT_SAFE_NUMERIC_HPP
|
||||
#define BOOST_NUMERIC_CONCEPT_SAFE_NUMERIC_HPP
|
||||
|
||||
// Copyright (c) 2015 Robert Ramey
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <limits>
|
||||
#include <typetraits>
|
||||
#include <boost/concept/usage.hpp>
|
||||
#include "concept/numeric.hpp"
|
||||
|
||||
namespace boost {
|
||||
namespace safe_numerics {
|
||||
|
||||
template<class T>
|
||||
struct SafeNumeric : public Numeric<T> {
|
||||
static_assert(
|
||||
is_safe<T>::value,
|
||||
"std::numeric_limits<T> has not been specialized for this type"
|
||||
);
|
||||
BOOST_CONCEPT_USAGE(SafeNumeric){
|
||||
using t1 = get_exception_policy<T>;
|
||||
using t2 = get_promotion_policy<T>;
|
||||
using t3 = base_type<T>;
|
||||
}
|
||||
};
|
||||
|
||||
} // safe_numerics
|
||||
} // boost
|
||||
|
||||
#endif // BOOST_NUMERIC_CONCEPT_SAFE_NUMERIC_HPP
|
||||
Reference in New Issue
Block a user