C++ Logo


Advanced search

Re: Template qualifiers

From: Andrey Semashev <andrey.semashev_at_[hidden]>
Date: Fri, 4 Oct 2019 11:27:04 +0300
On 2019-10-04 08:15, Phil Bouchard via Std-Proposals wrote:
> 2. a) Like I was saying before, the need for the "const" overloads on
> the "this" parameter forces us to create redundant code and disregards
> the "volatile" qualifier:
> https://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a06712.html
> 2. b) The only solution I can foresee is to add a new "qualifier"
> template token type:
> template <qualifier Q>
> iterator end () Q noexcept;

This isn't right. The return type must be iterator or const_iterator,
depending on the method qualification.

There isn't such thing as "qualifier" in C++ in the sense distinct from
a type. IOW, qualifier is always part of a type. If you propose to
introduce qualifiers as a distinct entity, you will have to define how
the shall interact with other parts of the language. Especially, what
parts it will break.

Honestly, I don't find your arguments compelling enough for introducing
qualifiers as a distinct entity.

Received on 2019-10-04 03:29:21