C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] std::as
From: Giuseppe D'Angelo (giuseppe.dangelo_at_[hidden])
Date: 2020-11-06 10:55:57


Il 06/11/20 17:47, Christof Franke via Std-Proposals ha scritto:
> I have tested GCC, clang, and MSVC. They all remove any double-checks
> and exception code during optimization.
>
> In case you want to call a function with a std::variant as parameter of
> which the alternative held by the variant is known, why do you pass the
> variant instead of the value held?
>

The question is why paying for *any* check (and having to rely on QoI,
optimizations enabled, etc.) when you know that a variant contains a
given alternative?

Thanks,

-- 
Giuseppe D'Angelo | giuseppe.dangelo_at_[hidden] | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts



STD-PROPOSALS list run by std-proposals-owner@lists.isocpp.org

Standard Proposals Archives on Google Groups