-
-
Couldn't load subscription status.
- Fork 3.2k
Open
Description
Description
There are various reasons why a class or function may have multiple non-type template parameters, including (but not limited to) compile-time feature toggling, guaranteed compile-time branch elimination, and multidimensional spans and containers with compile-time extents.
There are already two features that are close to the request, but none seem to satisfy it exactly:
- Generators allow going through a Cartesian product of inputs.
- Type parametrised test cases have
TEMPLATE_PRODUCT_TEST_CASEfor combining types, and signature-based parametrised tests allow traversing compile-time constants. TEMPLATE_LIST_TEST_CASEallows using anstd::tupleto represent types. Using anstd::tupleofconstexprvalues forTEMPLATE_TEST_CASE_SIGwould allow for at least manual compile-time generation of all required combinations.
Evident limitations of these approaches in the context of the request:
- Generators do not support
constexprvalues, so they cannot be used for non-type template parameters. - A signature-based parameterised test argument list grows exponentially with any additional argument that needs to be combined with the others.
- The template list test case does not support values directly. However, there is std::integral_constant, which is sufficient for a lot of applications, but not all, because non-type template parameters are not limited to integral constants.
Additional context
Another user already made a similar request and was satisfied with the proposed solution, but I cannot reopen it and am unsure whether a comment in the closed issue would be lost.
Metadata
Metadata
Assignees
Labels
No labels