promotion_policy.hpp 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. #ifndef BOOST_NUMERIC_CONCEPT_PROMOTION_POLICY_HPP
  2. #define BOOST_NUMERIC_CONCEPT_PROMOTION_POLICY_HPP
  3. // Copyright (c) 2015 Robert Ramey
  4. //
  5. // Distributed under the Boost Software License, Version 1.0. (See
  6. // accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. namespace boost {
  9. namespace safe_numerics {
  10. template<class PP>
  11. struct PromotionPolicy {
  12. using T = int;
  13. using U = int;
  14. using a_type = typename PP::template addition_result<T, U>;
  15. using s_type = typename PP::template subtraction_result<T, U>;
  16. using m_type = typename PP::template multiplication_result<T, U>;
  17. using d_type = typename PP::template division_result<T, U>;
  18. using mod_type = typename PP::template modulus_result<T, U>;
  19. using ls_type = typename PP::template left_shift_result<T, U>;
  20. using rs_type = typename PP::template right_shift_result<T, U>;
  21. using cc_type = typename PP::template comparison_result<T, U>;
  22. using baw_type = typename PP::template bitwise_and_result<T, U>;
  23. using bow_type = typename PP::template bitwise_or_result<T, U>;
  24. using bxw_type = typename PP::template bitwise_xor_result<T, U>;
  25. };
  26. } // safe_numerics
  27. } // boost
  28. #endif // BOOST_NUMERIC_CONCEPT_EXCEPTION_POLICY_HPP