mirror of
https://github.com/boostorg/safe_numerics.git
synced 2026-01-22 17:52:11 +00:00
corrections in cpp promotion added make_safe_literal separated integers from other types dropped example91 updated CMakeLists.txt and Jamfile.v2 accordingly
32 lines
736 B
C++
32 lines
736 B
C++
#include <boost/integer.hpp>
|
|
#include "../include/utility.hpp"
|
|
|
|
// include headers to support safe integers
|
|
#include "../include/cpp.hpp"
|
|
//#include "../include/exception.hpp"
|
|
|
|
using promotion_policy = boost::numeric::cpp<
|
|
8, // char 8 bits
|
|
16, // short 16 bits
|
|
16, // int 16 bits
|
|
16, // long 32 bits
|
|
32 // long long 32 bits
|
|
>;
|
|
|
|
template<typename R, typename T, typename U>
|
|
struct test {
|
|
using ResultType = promotion_policy::result_type<T,U>;
|
|
//boost::numeric::utility::print_type<ResultType> pt;
|
|
static_assert(
|
|
std::is_same<R, ResultType>::value,
|
|
"is_same<R, ResultType>"
|
|
);
|
|
};
|
|
|
|
test<std::uint16_t, std::uint8_t, std::uint8_t> t1;
|
|
|
|
int main(){
|
|
return 0;
|
|
}
|
|
|