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
is
> 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
if
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
https://www.youtube.com/watch?v=Ke1mJiGO-pU (for CPU with virtual memory).


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk