gulrak / filesystem

An implementation of C++17 std::filesystem for C++11 /C++14/C++17/C++20 on Windows, macOS, Linux and FreeBSD.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Optional way to use ghc::filesystem with forwarding header and one time included implementation

gulrak opened this issue · comments

Is your feature request related to a problem? Please describe.

When ghc::filesystem is used in multiple places of a project, there is a compiletime overhead due to the header-only, everything-inline nature of the library. In such situations it might be nice to be able to concentrate the implementation into a single place and include only the nessesery elements in all the other places.

This also comes with the advantage, that the needed system includes (e.g. windows.h) will only be needed at the implementation place, so thes do not pollute the global namespace in every place filesystem is used.

Describe the solution you'd like

Two small wrapping headers should be added, they set some defines and include the normal filesystem.hpp header. One called fs_fwd.hpp will ensure everything needed to use ghc::filesystem is visible, the other, called fs_impl.hpp will lead to the expansion of all implementation code and use the system headers needed to implement the functionality.
The implementation header must be included in a cpp before the visibility of a fs_fwd.hpp to take precedence in the code extraction.

First implementation will be done on a feature branch.

This feature is related to some wishes from #3.

Changes tested on macOS, Windows and Linux are now on master, still as a work-in-progress, but feedback is welcome.

Released with Release v1.1.0