C++ Logo

std-proposals

Advanced search

Re: std::as

From: Giuseppe D'Angelo <giuseppe.dangelo_at_[hidden]>
Date: Fri, 6 Nov 2020 17:55:57 +0100
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

Received on 2020-11-06 10:56:05