| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
rebased to main |
Sorry, something went wrong.
|
Thanks! I think this sets a record for the fastest non-trivial cppfront PR review yet... I tried the code in my own branch and it just worked on the first try with all three compilers. Groovy. Merging... |
Sorry, something went wrong.
|
BTW for other readers: One reason this could be reviewed so quickly is because the P2392 design paper for inspect/is/as called out matching templates as one of the intended matching rules (section 2.1):
... which just hadn't been implemented yet in cppfront, so this extension PR is on plan. Thanks @filipsajdak |
Sorry, something went wrong.
|
Thank you. I proposed it based on the paper - https://wg21.link/p2392 |
Sorry, something went wrong.
…atchers-for-templates [SUGGESTION] Add inspect `is()` matchers for templates
| Back | FazBrowse Home | New Git URL |
Thanks to other experiments I have added the possibility to inspect if a type is a template. That will allow generic code to check if we deal with std::vector, std::array, std::unique_ptr, std::variant, or std::initializer_list (working prototype with more templates I have checked is here: https://godbolt.org/z/ddMdq5W4T).
This change makes below code possible:
Limitations
The current solution is based on template template arguments. The current solution will work with templates that match:
Unfortunately, there is no way of having a universal match for type and non-type parameters in a variadic way. If needed more matches there would be a need to create more combinations of template template arguments.