Unverified Commit e96daa80 authored by Dominik Charousset's avatar Dominik Charousset Committed by GitHub

Merge pull request #887

Fix linker issue when building with Clang 7
parents 53ab97d2 832055b6
...@@ -263,7 +263,7 @@ struct sum_type_access<config_value> { ...@@ -263,7 +263,7 @@ struct sum_type_access<config_value> {
template <class U, int Pos> template <class U, int Pos>
static bool is(const config_value& x, sum_type_token<U, Pos> token) { static bool is(const config_value& x, sum_type_token<U, Pos> token) {
return x.get_data().is(token.pos); return x.get_data().is(pos(token));
} }
template <class U> template <class U>
...@@ -273,7 +273,7 @@ struct sum_type_access<config_value> { ...@@ -273,7 +273,7 @@ struct sum_type_access<config_value> {
template <class U, int Pos> template <class U, int Pos>
static U& get(config_value& x, sum_type_token<U, Pos> token) { static U& get(config_value& x, sum_type_token<U, Pos> token) {
return x.get_data().get(token.pos); return x.get_data().get(pos(token));
} }
template <class U> template <class U>
...@@ -283,7 +283,7 @@ struct sum_type_access<config_value> { ...@@ -283,7 +283,7 @@ struct sum_type_access<config_value> {
template <class U, int Pos> template <class U, int Pos>
static const U& get(const config_value& x, sum_type_token<U, Pos> token) { static const U& get(const config_value& x, sum_type_token<U, Pos> token) {
return x.get_data().get(token.pos); return x.get_data().get(pos(token));
} }
template <class U> template <class U>
......
...@@ -39,17 +39,17 @@ struct default_sum_type_access { ...@@ -39,17 +39,17 @@ struct default_sum_type_access {
template <class U, int Pos> template <class U, int Pos>
static bool is(const T& x, sum_type_token<U, Pos> token) { static bool is(const T& x, sum_type_token<U, Pos> token) {
return x.get_data().is(token.pos); return x.get_data().is(pos(token));
} }
template <class U, int Pos> template <class U, int Pos>
static U& get(T& x, sum_type_token<U, Pos> token) { static U& get(T& x, sum_type_token<U, Pos> token) {
return x.get_data().get(token.pos); return x.get_data().get(pos(token));
} }
template <class U, int Pos> template <class U, int Pos>
static const U& get(const T& x, sum_type_token<U, Pos> token) { static const U& get(const T& x, sum_type_token<U, Pos> token) {
return x.get_data().get(token.pos); return x.get_data().get(pos(token));
} }
template <class U, int Pos> template <class U, int Pos>
......
...@@ -23,8 +23,11 @@ ...@@ -23,8 +23,11 @@
namespace caf { namespace caf {
template <class T, int Pos> template <class T, int Pos>
struct sum_type_token { struct sum_type_token {};
static constexpr auto pos = std::integral_constant<int, Pos>{};
}; template <class T, int Pos>
constexpr std::integral_constant<int, Pos> pos(sum_type_token<T, Pos>) {
return {};
}
} // namespace caf } // namespace caf
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