When to use strfwd.h

Jean-Marc Lasgouttes lasgouttes at lyx.org
Tue Oct 1 11:02:29 UTC 2024


Le 01/10/2024 à 12:23, Pavel Sanda a écrit :
> On Tue, Oct 01, 2024 at 11:12:00AM +0200, Jean-Marc Lasgouttes wrote:
>> Basically, for gcc >=5 and libc++, we include <string>. Unless there is
>> something I do not understand, the header is not really useful IMO.
> 
> Are you sure about this? I checked before sending my email and while
> empty file with #include <string> produces 22k preprocesed lines,
> #include "strfwd.h" on my debian stable produce ~400 lines
> of preprocessed code including homebrewed
> template<typename Char, typename Traits, typename Alloc> class basic_string;
> typedef basic_string<char, char_traits<char>, allocator<char> > string;

I am not sure, I tried to read the code, but I might have been lost in 
ifdefs. How did you check your preprocessed code? Did you include 
<config.h> ?

Have a look at Box.{cpp,h}, the simplest user. It uses "strfwd.h" only 
for <ostream>.

Now have a look in your build directory at
src/.deps/Box.Po

You should see that <string> is loaded for no reason.

JMarc



More information about the lyx-devel mailing list