[Development] Template-meta-programming do's and don'ts

Mårten Nordheim marten.nordheim at qt.io
Tue May 2 12:02:36 CEST 2023


I think 'yes' is an easy answer. Having a convention that matches the
is_same/is_same_v enable_if/enable_if_t paradigm could make some things
easier, avoiding the need to wrap constexpr bool values in bool_constant<T>
when there is no non-'_v' version of the check yet.
But someone also has to write something that can be agreed upon, and
then it needs to be enforced as well.


Mårten

> -----Original Message-----
> From: Development <development-bounces at qt-project.org> On Behalf Of
> Volker Hilsheimer via Development
> Sent: tirsdag 2. mai 2023 11:00
> To: development at qt-project.org
> Subject: [Development] Template-meta-programming do's and don'ts
> 
> During header review we identified a few cases where e.g. using
> std::conjunction/disjunction wasn’t used, or not used optimally. Using
> suboptimal constructs can result in significant compile-time penalties.
> 
> We generally don’t have a lot of guidelines for template-meta-programming.
> Should we have some?
> 
> 
> Volker
> 
> --
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development


More information about the Development mailing list