hsutter / cppfront

A personal experimental C++ Syntax 2 -> Syntax 1 compiler
Other
5.46k stars 238 forks source link

refactor(util): merge built-in `is`/`as` type overloads #956

Closed JohelEGP closed 8 months ago

hsutter commented 8 months ago

@filipsajdak @JohelEGP Will this conflict with #701? My impression is #701 is almost ready to review again?

filipsajdak commented 8 months ago

@hsutter #701 is() part is ready. I need to split this PR into two. One for is() and one for as()

JohelEGP commented 8 months ago

Will this conflict with #701?

Yes, that's intentional. This PR provides the first the first and most important step to rein in the complexity of adding more is overloads.

hsutter commented 8 months ago

Thanks! This is looking good.

The only thing I notice is that it passes CI on everything except Xcode 13. Looks like the only problem is that Xcode 13 doesn't have C++20 iter_reference_t which is used in one condition.

I've pushed a commit to this PR to try to eliminate that dependency by adding this:

template <typename T>
    requires requires { *std::declval<T&>(); }
using deref_t = decltype(*std::declval<T&>());

... and using that instead of iter_reference_t.

Does that seem like the right solution? Hopefully that will unbreak Xcode 13... Now that we have CI (thanks again!) I can push and find out...

hsutter commented 8 months ago

Yup, that unbroke Xcode 13... should be ready to merge. Thanks!