I'm so glad that concepts and _if constexpr_ have given a more readable alternative to SFINAE and messy type traits like enable_if; and that contexpr functions have mostly obsoleted recursive TMP by making compile time code look like runtime code. I recently replaced a couple of recursive TMP functions that filled some arrays with the results of recursive formulae with a single constexpr function and it was such a pleasure. An likewise, I replaced a class that had several template specialisations but was mostly similar with a few if constexprs.
it wasn't touched on during the stream, and i wasn't able to watch live, so i'll ask here: what's the benefit (if any) of the seemingly more complex "unique2" function, compared to the simpler recursive "unique" version? are there other use cases where such an implementation could be more beneficial?
Benefit is a somewhat relative term. I just wanted to showcase multiple ways of doing it and how you can leverage standard algorithms in a constexpr context
I'm so glad that concepts and _if constexpr_ have given a more readable alternative to SFINAE and messy type traits like enable_if; and that contexpr functions have mostly obsoleted recursive TMP by making compile time code look like runtime code.
I recently replaced a couple of recursive TMP functions that filled some arrays with the results of recursive formulae with a single constexpr function and it was such a pleasure. An likewise, I replaced a class that had several template specialisations but was mostly similar with a few if constexprs.
Glad I had some time to rewatch it, unique2 was something I've never seen before!
Always fun to hang out with you and people in chat. Had a blast last evening :)
it wasn't touched on during the stream, and i wasn't able to watch live, so i'll ask here:
what's the benefit (if any) of the seemingly more complex "unique2" function, compared to the simpler recursive "unique" version?
are there other use cases where such an implementation could be more beneficial?
Benefit is a somewhat relative term. I just wanted to showcase multiple ways of doing it and how you can leverage standard algorithms in a constexpr context
@@nathanbaggs i see, thanks