Commit 22f345f1 authored by Dominik Charousset's avatar Dominik Charousset

Add aliases for common atom constant types

parent ab1a7a92
......@@ -34,7 +34,6 @@ enum class atom_value : uint64_t {
/** @cond PRIVATE */
dirty_little_hack = 31337
/** @endcond */
};
/**
......@@ -47,9 +46,33 @@ constexpr atom_value atom(char const (&str)[Size]) {
return static_cast<atom_value>(detail::atom_val(str, 0xF));
}
/**
* Type alias for treating atom constants at compile-time
* (cf. "Int-ToType" idiom).
*/
template <atom_value Value>
using atom_constant = std::integral_constant<atom_value, Value>;
/**
* Generic 'GET' atom for request operations.
*/
using get_atom = atom_constant<atom("GET")>;
/**
* Generic 'PUT' atom for request operations.
*/
using put_atom = atom_constant<atom("PUT")>;
/**
* Generic 'OK' atom for response messages.
*/
using ok_atom = atom_constant<atom("OK")>;
/**
* Generic 'ERROR' atom for response messages.
*/
using error_atom = atom_constant<atom("ERROR")>;
} // namespace caf
#endif // CAF_ATOM_HPP
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment