Commit 53c92ec6 authored by Dominik Charousset's avatar Dominik Charousset

Rewind atom sytnax sugar due to compiler issues

parent d729bd2a
...@@ -38,11 +38,6 @@ enum class atom_value : uint64_t { ...@@ -38,11 +38,6 @@ enum class atom_value : uint64_t {
/// @relates atom_value /// @relates atom_value
std::string to_string(const atom_value& x); std::string to_string(const atom_value& x);
/// @relates atom_value
constexpr uint64_t to_u64(atom_value x) {
return static_cast<uint64_t>(x);
}
atom_value atom_from_string(const std::string& x); atom_value atom_from_string(const std::string& x);
/// Creates an atom from given string literal. /// Creates an atom from given string literal.
...@@ -63,6 +58,9 @@ struct atom_constant { ...@@ -63,6 +58,9 @@ struct atom_constant {
constexpr operator atom_value() const { constexpr operator atom_value() const {
return V; return V;
} }
static constexpr uint64_t uint_value() {
return static_cast<uint64_t>(V);
}
/// Returns an instance *of this constant* (*not* an `atom_value`). /// Returns an instance *of this constant* (*not* an `atom_value`).
static const atom_constant value; static const atom_constant value;
}; };
...@@ -78,15 +76,10 @@ struct is_atom_constant<atom_constant<X>> { ...@@ -78,15 +76,10 @@ struct is_atom_constant<atom_constant<X>> {
}; };
template <atom_value V> template <atom_value V>
std::string to_string(atom_constant<V>) { std::string to_string(const atom_constant<V>&) {
return to_string(V); return to_string(V);
} }
template <atom_value V>
constexpr uint64_t to_u64(atom_constant<V>) {
return static_cast<uint64_t>(V);
}
template <atom_value V> template <atom_value V>
const atom_constant<V> atom_constant<V>::value = atom_constant<V>{}; const atom_constant<V> atom_constant<V>::value = atom_constant<V>{};
......
...@@ -239,7 +239,7 @@ void basp_broker_state::deliver(const node_id& src_nid, actor_id src_aid, ...@@ -239,7 +239,7 @@ void basp_broker_state::deliver(const node_id& src_nid, actor_id src_aid,
switch (static_cast<uint64_t>(msg.get_as<atom_value>(0))) { switch (static_cast<uint64_t>(msg.get_as<atom_value>(0))) {
default: default:
break; break;
case to_u64(link_atom::value): { case link_atom::value.uint_value(): {
if (src_nid != this_node()) { if (src_nid != this_node()) {
CAF_LOG_WARNING("received link message for an other node"); CAF_LOG_WARNING("received link message for an other node");
return; return;
...@@ -258,7 +258,7 @@ void basp_broker_state::deliver(const node_id& src_nid, actor_id src_aid, ...@@ -258,7 +258,7 @@ void basp_broker_state::deliver(const node_id& src_nid, actor_id src_aid,
static_cast<actor_proxy*>(ptr->get())->local_link_to(src->get()); static_cast<actor_proxy*>(ptr->get())->local_link_to(src->get());
return; return;
} }
case to_u64(unlink_atom::value): { case unlink_atom::value.uint_value(): {
if (src_nid != this_node()) { if (src_nid != this_node()) {
CAF_LOG_WARNING("received unlink message for an other node"); CAF_LOG_WARNING("received unlink message for an other node");
return; return;
......
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