Boost logo

Boost :

Subject: Re: [boost] [system] virtual ~error_category
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2018-02-12 23:29:51

>> Ok, cool. For the record, proposed `status_code` is templated and thus
>> can carry arbitrary payload, thus solving that problem in `error_code`.
> Bear in mind that templating can itself be a barrier to usage,
> especially when people want to keep implementation in cpp files rather
> than making everything into templates.
> (I'm not saying that templating is the wrong choice, but this was
> probably one of the motivations for current error_code not being a
> template.)

Both status_code and status_code_domain come in type erased and
templated forms. If you use the templated form, the optimiser eliminates
all runtime overhead in recent GCCs and clangs, even down to eliminating
instantiating the domain singleton because it's a constexpr variable. If
you use the type erased form, you do incur the indirect branch overhead
unless you turn on LTO.

So, you're covered.


ned Productions Limited Consulting

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