Skip to content

Commit 262b86f

Browse files
committed
Rework of is and as that adds new functionalities or simplify implementation
* added concepts for simplify and utilize concept subsumption rules, * added `type_find_if` to iterate over `variant` types to simplify is/as for variant, * rewrite `is` and `as` overloads to use `concepts` instead of `type_traits` (to utilize concepts subsumption rules), * rewrite `narrowing`, `castable` as concepts, * `castable` return true for types that could be directly casted with `C{x}`, * remove `operator_is`, and `operator_as`, implementation of `is`/`as` for variants now use `type_find_if`, * fix to ommit `to_string(...)` overload in `x as std::string`, * fix incidental loss-casting of predicate argument e.g. `double` to `int` - now there is a check if there is a valid casting, * e.g. `3.14 is (:(i:int) -> _ = return i == 3;)` - after this change returns false (currently returns true), * the same fix for optionals: `std::optional(3.14) is (:(v:std::optional<int>)->bool = v* == 3;)` * predicate can return type that fulfills `std::convertible_to<bool>`, * add possibility to check if object fulfills concept by using `x is (:<T:std::integral>() = {})` syntax, * add possibility to use free function (also generic) as predicates, * in case of checking against `variant` generic function will get `variant` not a type that it contains,
1 parent d9656a0 commit 262b86f

File tree

6 files changed

+420
-443
lines changed

6 files changed

+420
-443
lines changed

0 commit comments

Comments
 (0)