Silicium
byte.hpp
Go to the documentation of this file.
1 #ifndef SILICIUM_BYTE_HPP
2 #define SILICIUM_BYTE_HPP
3 
4 #include <boost/cstdint.hpp>
5 #include <boost/functional/hash.hpp>
6 
7 namespace Si
8 {
9  enum class byte : boost::uint8_t
10  {
11  minimum = 0,
12  zero = 0,
13  one = 1,
14  maximum = 255
15  };
16 
17  inline std::size_t hash_value(byte value)
18  {
19  using boost::hash_value;
20  return hash_value(static_cast<boost::uint8_t>(value));
21  }
22 
23  template <class Char>
24  std::basic_ostream<Char> &operator << (std::basic_ostream<Char> &out, byte value)
25  {
26  return out << static_cast<unsigned>(value);
27  }
28 }
29 
30 namespace std
31 {
32  template <>
33  struct hash<Si::byte>
34  {
35  std::size_t operator()(Si::byte value) const
36  {
37  return hash_value(value);
38  }
39  };
40 }
41 
42 #endif
Definition: absolute_path.hpp:352
Definition: absolute_path.hpp:19
std::size_t operator()(Si::byte value) const
Definition: byte.hpp:35
byte
Definition: byte.hpp:9
SILICIUM_USE_RESULT std::size_t hash_value(absolute_path const &value)
Definition: absolute_path.hpp:220
std::size_t hash_value(byte value)
Definition: byte.hpp:17