Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

static inline functions in a header only library #42

Open
klosworks opened this issue Jul 14, 2019 · 0 comments · May be fixed by #84
Open

static inline functions in a header only library #42

klosworks opened this issue Jul 14, 2019 · 0 comments · May be fixed by #84

Comments

@klosworks
Copy link

klosworks commented Jul 14, 2019

You have a lot of static inline functions, such as

  static inline std::vector<std::string>
split(const std::string& str, const std::string& delims=" \t")

The problem is, with static functions, the compiler will create a separate internal copy of the function in every translation unit that has included subprocess.hpp. In large projects this can grow to huge numbers.
Those functions should be just inline, without static. This way they will be visible to the linker, so it will remove the copies.

@ObiWahn ObiWahn linked a pull request Mar 20, 2023 that will close this issue
ObiWahn added a commit to obiwahn-pr/cpp-subprocess that referenced this issue Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant