C++ Logo


Advanced search

Subject: Re: [std-proposals] Make class template parameters available externally
From: Dmitry (dimanne_at_[hidden])
Date: 2019-11-01 16:16:37

So, I have incorporated (all) your feedback in the proposal:

   - now the feature is opt-in
   - private/protected/public keywords are used: template<public typename A,
   protected int B>
   - New compiler errors are discussed: when there is a propagated template
   parameter and user-defined one with the same name.

Here is a link
the proposal (leading directly to the new opt-in approach).

And also there are my thoughts on the question about the upcoming class
types in non-type template parameters
"Namely, do we want to have references (static constexpr int &B = _B; in
the example above), or values (static constexpr int B = _B;)?
No matter how smart structures it will be possible to use as template
arguments, (after instantiation) they are just smartly-mangled
(16IntegralConstantIPFiRiEXadL_Z3fooIiEiRT_EEE) old plain C structs, and
they are entirely handled in compile-time. From this point of view, there
is little point in using references. Perhaps, a safer approach would be to
understand how compile-time calculations implemented in the modern
compilers, in particular whether "compile-time reference" makes sense or

*Sent from gmail*

STD-PROPOSALS list run by herb.sutter at gmail.com

Standard Proposals Archives on Google Groups