Subject: Re: extremely long compile time with large number of string literals
From: Thiago Macieira (thiago_at_[hidden])
Date: 2020-07-18 12:30:29
On Saturday, 18 July 2020 09:44:02 PDT Mandeep Sandhu wrote:
> > Ideally a constexpr string object using constexpr operator new could do
> > that, but such a thing does not exist in C++ yet and definitely did not
> > for C++11 or C++14.
> > The best you can get until is to benefit from the Small String
> > Optimisation.
> What is the size threshold at which SSO kicks in? Is it implementation
> defined? Is there a way to figure out if a string has been "SSO-ed" ?
It's implementation defined. You can tell that it has kicked in when
str.c_str() points to inside of str. But don't try to determine that, just
write code without assuming where std::string stores data.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Software Architect - Intel System Software Products
STD-DISCUSSION list run by firstname.lastname@example.org
Older Archives on Google Groups