diff options
| author | John Hodge <tpg@ucc.asn.au> | 2019-01-27 11:06:21 +0800 |
|---|---|---|
| committer | John Hodge <tpg@ucc.asn.au> | 2019-01-27 11:06:21 +0800 |
| commit | 4f48058690ffc6af273a49eeb909d792163cade9 (patch) | |
| tree | 95bd3f0a836ca2a3081e5c473e93be69b031f4c6 /src/include | |
| parent | d1ea840742dac3d3af66667508c8a841a6c6ca70 (diff) | |
| download | mrust-4f48058690ffc6af273a49eeb909d792163cade9.tar.gz | |
macro_rules - Rework pattern matching into a "compiled" format (easier to disambiguate)
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/tagged_union.hpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/include/tagged_union.hpp b/src/include/tagged_union.hpp index d249de13..dab7f8ea 100644 --- a/src/include/tagged_union.hpp +++ b/src/include/tagged_union.hpp @@ -122,7 +122,7 @@ #define TU_ARM(VAR, TAG, NAME) break; case ::std::remove_reference<decltype(VAR)>::type::TAG_##TAG: for(bool tu_lc = true; tu_lc; tu_lc=false) for(auto& NAME = (VAR).as_##TAG(); (void)NAME, tu_lc; tu_lc=false) #define TU_MATCH_HDRA(VARS, brace) TU_MATCH_HDRA_(::std::remove_reference<decltype(TU_FIRST VARS)>::type, VARS, brace) -#define TU_MATCH_HDRA_(CLASS, VARS, brace) const auto& tu_match_hdr2_v = (TU_FIRST VARS); switch( tu_match_hdr2_v.tag() ) brace case CLASS::TAGDEAD: assert(!"ERROR: destructed tagged union used"); +#define TU_MATCH_HDRA_(CLASS, VARS, brace) auto& tu_match_hdr2_v = (TU_FIRST VARS); switch( tu_match_hdr2_v.tag() ) brace case CLASS::TAGDEAD: assert(!"ERROR: destructed tagged union used"); // Evil hack: two for loops, the inner stops the outer after it's done. #define TU_ARMA(TAG, NAME) break; case ::std::remove_reference<decltype(tu_match_hdr2_v)>::type::TAG_##TAG: for(bool tu_lc = true; tu_lc; tu_lc=false) for(auto& NAME = tu_match_hdr2_v.as_##TAG(); (void)NAME, tu_lc; tu_lc=false) |
