C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Extension to runtime polymorphism proposed

From: Andre Kostur <andre_at_[hidden]>
Date: Sat, 4 Apr 2026 07:35:32 +0000
On Sat, Apr 4, 2026 at 6:53 AM Muneem <itfllow123_at_[hidden]> wrote:
>
> Sorry for the late reply( I was showering and using hair oil)
> Sorry for my confusing reply, really sorry.
> The short answer is:
> NO
> The long answer is:
> The rules for templates would apply here, and concepts can be used to further constraint the requirements and make any resulting errors readable, so basically, it would work only if vector and list have the member capacity.

That's why I chose capacity(), it doesn't exist in one of the types.
So you're suggesting that the compile would have to try the syntax
against every type in the set?

This answer seems inconsistent with one of your previous answers
regarding the type of 'x': "The answer is the *********const reference
type********* of the object at the index read' (ignoring the const
part). If the type of x is std::vector<int>, then there should be no
reason to fail to compile a call to capacity().

Received on 2026-04-04 07:35:45