mn_byte.hpp
Go to the documentation of this file.
1 
19 #ifndef _MINLIB_BYTE_H_
20 #define _MINLIB_BYTE_H_
21 
22 #include "mn_functional.hpp"
23 
24 namespace mn {
25  using mn::byte;
26 
27  template<typename IntegerType, class = typename mn::enable_if<mn::is_integral<IntegerType>::value>::type>
28  inline IntegerType to_integer(byte b) {
29  return IntegerType(b);
30  }
31 
32  template < class IntegerType, class = typename mn::enable_if<mn::is_integral<IntegerType>::value>::type>
33  inline constexpr byte to_byte( IntegerType v ) noexcept {
34  return static_cast<byte>( v );
35  }
36 
37  inline constexpr unsigned char to_uchar( byte b ) noexcept {
38  return to_integer<unsigned char>( b );
39  }
40 
41  inline constexpr unsigned char to_uchar( int i ) noexcept {
42  return static_cast<unsigned char>( i );
43  }
44 
45 }
46 
47 #endif // _MINLIB_BYTE_H_
struct mn::memory::detail::ptr_difference type
Definition: mn_allocator_typetraits.hpp:25
constexpr unsigned char to_uchar(byte b) noexcept
Definition: mn_byte.hpp:37
constexpr byte to_byte(IntegerType v) noexcept
Definition: mn_byte.hpp:33
IntegerType to_integer(byte b)
Definition: mn_byte.hpp:28
byte
Definition: mn_def.hpp:88