[RFC] move COW basic_string and SSO basic_string to separate files
Jonathan Wakely
jwakely@redhat.com
Tue Dec 11 14:31:00 GMT 2018
Often when I'm poking around in <bits/basic_string.h> and/or
<bits/basic_string.tcc> I lose context and am not sure if I'm looking
at a member of the old string type or the new one. I've considered
putting comments above each member definition in the .tcc file saying
"COW" or "SSO" but asimpler solution might be to move the definitions
to separate files.
This has the additional advantage of only having to parse the one
we're actually using in a given translation unit:
#if _GLIBCXX_USE_CXX11_ABI
# include <bits/sso_string.h>
#else
# include <bits/cow_string.h>
#endif
That's approx. 3500 fewer lines to preprocess per compilation.
Are there advantages to having them both in one place? For example,
when fixing a bug, is it helpful to be able to find all occurrences of
a name in a single file, across both COW and SSO types? Since the
members are already spread across the .h and .tcc files, I think that
ship already sailed.
More information about the Libstdc++
mailing list