You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Allow multiple consecutive `as`
- Correctly distinguish 'is/as Type' and 'is expression'
- Treat C/C++'s built-in keyword types as type-ids (e.g., `int`) and recognize them in _type-id_ and not in _primary-expression_
- Treat C/C++'s built-in keyword quasi-identifiers are non-keywords (`false,` `new`, `nullptr`, `true`)
- Switch to _type-id_ in _unqualified-id_ and , where before we were still having _id-expression_ doing double duty as an early grammar shortcut
if (cpp2::is(__expr, (less_then(10)))) { ifconstexpr( requires{"i less than 10";} ) ifconstexpr( std::is_convertible_v<CPP2_TYPEOF(("i less than 10")),std::string> ) return"i less than 10"; elsereturn std::string{}; elsereturn std::string{}; }
33
+
if (cpp2::is(__expr, (less_than(10)))) { ifconstexpr( requires{"i less than 10";} ) ifconstexpr( std::is_convertible_v<CPP2_TYPEOF(("i less than 10")),std::string> ) return"i less than 10"; elsereturn std::string{}; elsereturn std::string{}; }
34
34
elseif (cpp2::is(__expr, in(11, 20))) { ifconstexpr( requires{"i is between 11 and 20";} ) ifconstexpr( std::is_convertible_v<CPP2_TYPEOF(("i is between 11 and 20")),std::string> ) return"i is between 11 and 20"; elsereturn std::string{}; elsereturn std::string{}; }
35
35
elsereturn"i is out of our interest"; }
36
36
() << std::endl;
37
37
38
-
if (cpp2::is(i, less_then(20))) {
38
+
if (cpp2::is(i, (less_than(20)))) {
39
39
std::cout << "less than 20" << std::endl;
40
40
}
41
41
42
-
if (cpp2::is(std::move(i), in(10, 30))) {
42
+
if (cpp2::is(std::move(i), (in(10, 30)))) {
43
43
std::cout << "i is between 10 and 30" << std::endl;
0 commit comments