C++ Logo

std-proposals

Advanced search

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

From: Marcin Jaczewski <marcinjaczewski86_at_[hidden]>
Date: Thu, 2 Apr 2026 09:27:20 +0200
ad1) then why do you say that "For example: std::variant<int, double>
is possible"? And what exactly does means `std::variant<int,
int>{obj1, obj2}`? do you want `std::tuple`?

ad2) There is not guarantee that your proposal will be implemented in
any way more efficiently, would it be easier to require from compiler
creators to make a better version of `std::visit` than change
language?

czw., 2 kwi 2026 o 03:28 Muneem <itfllow123_at_[hidden]> napisał(a):
>
> Hi!
> 1. I in no way said std::variant<int, int> is impossible,but std::variant<int, int>{obj1, obj2} is impossible,since its a union.
> 2. It is not gurrentied* that std::visit will be implemented using switch case statements and even if that is true, it is still ugly and does not work for "object branching" like std::variant<int, int>{obj1, obj2}. I will show you some differences between std::visit and a macro based solution(two macros: one that uses swtich statements under the hood and to other that uses ternary statements) to back myself up.
>
> I didn't back myself up with Assembly code the measurements instantly because I was trying to find out what exactly to back up, and you were kind enough to tell me that.
> Thank you for your feedback!
>
> regards, muneem
>
> On Thu, Apr 2, 2026 at 6:16 AM Marcin Jaczewski <marcinjaczewski86_at_[hidden]> wrote:
>>
>> czw., 2 kwi 2026 o 01:37 Muneem via Std-Proposals
>> <std-proposals_at_[hidden]> napisał(a):
>> >
>> > This is the updated proposal
>> >
>> > On Thu, Apr 2, 2026 at 1:45 AM Muneem <itfllow123_at_[hidden]> wrote:
>> >>
>> >> Ok, I will draft a format proposal that outline all the problems (a whole class of problems), cite all the possible solutions, and then cite bjarne Stroustrup quotes from his old 2013 book to back my philosophy up. Give me some time and thank you for your feedback ❤️❤️
>> >>
>> >> Regards, Muneem
>> >>
>> >> On Thu, 2 Apr 2026, 1:15 am Thiago Macieira via Std-Proposals, <std-proposals_at_[hidden]> wrote:
>> >>>
>> >>> On Wednesday, 1 April 2026 10:52:08 Pacific Daylight Time Muneem via Std-
>> >>> Proposals wrote:
>> >>> > Okay, I won't make the JIT part in my proposal, but just so I know, you do
>> >>> > support me if I dont? Like you will vouch for me and help me in my actual
>> >>> > formal proposal?
>> >>>
>> >>> I haven't understood the problem yet. You need to start the proposal with the
>> >>> problems (plural) that need solving, preferably with multiple possible
>> >>> alternatives and showing why you think your solution is best.
>> >>>
>> >>> --
>> >>> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
>> >>> Principal Engineer - Intel Data Center - Platform & Sys. Eng.
>> >>> --
>> >>> Std-Proposals mailing list
>> >>> Std-Proposals_at_[hidden]
>> >>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>> >
>>
>>
>> Your description of `std::variant` is factually wrong, what pointers
>> in variant implementation? What function tables?
>> In theory every thing in `std::variant` could be implemented by
>> `swich` statements.
>> It look like you are confused about how varaint work, especially
>> saying that `std::variant<int, int>` is impossible.
>>
>>
>> Besides, do you know that references are the same thing as pointers
>> from a CPU perspective?
>>
>>
>> And finally what problem exactly are you solving? You said that
>> branches are bad, and?
>> No real example of a problem, no benchmarks justified your claims.
>>
>> You can use https://godbolt.org/ to prepare real working examples and use
>> https://quick-bench.com/ to create micro benchmarks that show that
>> your proposal is better in some specific cases.
>>
>> > --
>> > Std-Proposals mailing list
>> > Std-Proposals_at_[hidden]
>> > https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2026-04-02 07:27:33