Boost logo

Boost :

Subject: Re: [boost] [variant2] Need rationale for never-empty guarantee
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2019-03-02 19:47:43

On Fri, 1 Mar 2019 at 09:59, Peter Dimov via Boost <boost_at_[hidden]>

> Kind of, but as written this implies that std::variant has no costs, which
> is not true. The checks for valueless do carry a cost. Each visit(), for
> example, starts with `if(valueless) throw`, which is not necessary in
> variant2.

That is not true.
A typical implementation would just add an extra value to the switch, there
is no extra branch.

Boost list run by bdawes at, gregod at, cpdaniel at, john at