Boost logo

Boost :

Subject: Re: [boost] [variant2] Need rationale for never-empty guarantee
From: Nikita Kniazev (nok.raven_at_[hidden])
Date: 2019-03-01 18:08:41

> This reply actually addresses my question: visitation on boost::variant2
> faster than on std::variant because it does not have to account for the
> valueless state.

I would not expect perfomance differences on CPUs with branch predictor or
visitation translated into jump table (variant uses switch for this?).

> For example, resizing a std::vector implements the strong guarantee that
> state will be restored to before the resize if an exception is thrown in
> the middle of the resize.

Probably one should use different container type if a data types move/copy
can throw. There even a vector implementation that will not copy/move on
resize (for CPU with virtual memory).

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