summaryrefslogtreecommitdiff
path: root/src/sexpr/variant.hpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-07-23 23:55:41 -0700
committerBen Longbons <b.r.longbons@gmail.com>2014-08-05 17:41:35 -0700
commita7f64f0b39cb7141f16608c171b20bee452fd024 (patch)
tree6ceb293db3488161d4d5a620536560506e63134f /src/sexpr/variant.hpp
parent7abac74323e2566173ea586e9acadac1ebf59098 (diff)
downloadtmwa-a7f64f0b39cb7141f16608c171b20bee452fd024.tar.gz
tmwa-a7f64f0b39cb7141f16608c171b20bee452fd024.tar.bz2
tmwa-a7f64f0b39cb7141f16608c171b20bee452fd024.tar.xz
tmwa-a7f64f0b39cb7141f16608c171b20bee452fd024.zip
In magic, use Variant for all the old anonymous nested unions
Diffstat (limited to 'src/sexpr/variant.hpp')
-rw-r--r--src/sexpr/variant.hpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/sexpr/variant.hpp b/src/sexpr/variant.hpp
index 50ee77f..fbf9345 100644
--- a/src/sexpr/variant.hpp
+++ b/src/sexpr/variant.hpp
@@ -41,10 +41,11 @@ namespace sexpr
#define MATCH(expr) \
WITH_VAR(auto&&, _match_var, expr) \
switch (tmwa::sexpr::VariantFriend::get_state(_match_var))
-#define CASE(ty, var) \
- break; \
- case tmwa::sexpr::VariantFriend::get_state_for<ty, decltype(_match_var)>(): \
- WITH_VAR(ty, var, tmwa::sexpr::VariantFriend::unchecked_get<ty>(_match_var))
+#define TYPED_CASE(ty, var, look) \
+ break; \
+ case tmwa::sexpr::VariantFriend::get_state_for<look, decltype(_match_var)>(): \
+ WITH_VAR(ty, var, tmwa::sexpr::VariantFriend::unchecked_get<look>(_match_var))
+#define CASE(ty, var) TYPED_CASE(ty, var, std::remove_const<std::remove_reference<ty>::type>::type)
template<class... T>
class Variant