stdc++ issue: extremely long compile time with large number of string literals

Mandeep Sandhu mandeepsandhu.chd@gmail.com
Sat Jul 11 06:27:27 GMT 2020


>
> It's the array of std::string that the std::initializer_list refers to
> that causes the problem.
>
> In the faster code there is no array of std::string, it's an array of
> const char*. Initializing a const char* can't throw an exception, and
> destroying it is a no-op, so there's no exception handling code needed
> for the array.

Makes sense. Thanks for the explanation. I guess this is something to
keep in mind when using initializer_list with a large number of
non-trivial types.

-mandeep


More information about the Gcc-help mailing list