Skip to content

Don't #include <fstream> or <iostream> in headers. #291

Description

@yakra

Reduce compile time:
Don't #include <fstream> or <iostream> in headers.

#include <string> when needed. This can avoid extraneous:

Disassembly of section .text.startup:
0000000000000000 <_GLOBAL__sub_I_datacheck.cpp>:
0: 50 push rax
1: bf 00 00 00 00 mov edi,0x0
6: e8 00 00 00 00 call b <_GLOBAL__sub_I_datacheck.cpp+0xb>
b: bf 00 00 00 00 mov edi,0x0
10: be 00 00 00 00 mov esi,0x0
15: ba 00 00 00 00 mov edx,0x0
1a: 58 pop rax
1b: e9 00 00 00 00 jmp 20 <_GLOBAL__sub_I_datacheck.cpp+0x20>

https://stackoverflow.com/questions/31691280/what-does-global-sub-i-mean-in-nm-output#66254512

For forward declarations of fstreams, #include<iosfwd>.
Reddit links here, which links here.

Files:

  • WaypointQuadtree.h
  • Waypoint.h
  • Args.h
  • HGEdge.h
  • PlaceRadius.h
  • ErrorList.h

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions