header-only

When should I consider making a library header-only?

吃可爱长大的小学妹 提交于 2020-01-01 01:12:34
问题 Obviously template libraries need to be header only, but for non-templates, when should you make things header-only? 回答1: If you think your non-template library could be header-only, consider dividing it into two files anyway, then providing a third file that includes both the .h and the .cpp (with an include guard). Then anyone who uses your library in a lot of different TUs, and suspects that this might be costing a lot of compile time, can easily make the change to test it. Once you know

CLion doesn't resolve headers from external library

非 Y 不嫁゛ 提交于 2019-12-06 19:44:59
问题 Some time ago I started a big header library in C++1x using XCode. The current layout of the library is () something like (partial output from ls -R sponf ) sponf/sponf: ancestors sponf.h sponf_utilities.h categories sponf_children.h utilities children sponf_macros.h sponf/sponf/ancestors: function.h meter.h set.h simulation.h sponf/sponf/categories: free_space.h prng.h random_distribution.h series.h sponf/sponf/children: distributions histogram.h random simulations meters numeric series

Quantifiable metrics (benchmarks) on the usage of header-only c++ libraries

前提是你 提交于 2019-12-04 07:30:27
问题 I've tried to find an answer to this using SO. There are a number of questions that list the various pros and cons of building a header-only library in c++, but I haven't been able to find one that does so in quantifiable terms. So, in quantifiable terms, what's different between using traditionally separated c++ header and implementation files versus header only? For simplicity, I'm assuming that templates are not used (because they require header only). To elaborate, I've listed what I have

When should I consider making a library header-only?

久未见 提交于 2019-12-03 04:29:11
Obviously template libraries need to be header only, but for non-templates, when should you make things header-only? If you think your non-template library could be header-only, consider dividing it into two files anyway, then providing a third file that includes both the .h and the .cpp (with an include guard). Then anyone who uses your library in a lot of different TUs, and suspects that this might be costing a lot of compile time, can easily make the change to test it. Once you know users have the option which way to use the library, the answer probably becomes "offer that option whenever

In CLion, header only library: file “does not belong to any project target, code insight features might not work properly”

爷,独闯天下 提交于 2019-12-03 02:36:21
问题 I have a header-only library project set up with the cmake command: add_library(my_library INTERFACE) and I also added target_sources(my_library INTERFACE ${MY_LIRBARY_HEADER_FILES}) but when I open a source file, I get the warning: This file does not belong to any project target, code insight features might not work properly and I lose a lot of the functionality on things like code completion. What is the proper way to set this up so CLion provides its usual functionality on a header-only

In CLion, header only library: file “does not belong to any project target, code insight features might not work properly”

允我心安 提交于 2019-12-02 17:25:56
I have a header-only library project set up with the cmake command: add_library(my_library INTERFACE) and I also added target_sources(my_library INTERFACE ${MY_LIRBARY_HEADER_FILES}) but when I open a source file, I get the warning: This file does not belong to any project target, code insight features might not work properly and I lose a lot of the functionality on things like code completion. What is the proper way to set this up so CLion provides its usual functionality on a header-only library? sjaustirni Little background I was having the same problem, albeit the project was not header

Quantifiable metrics (benchmarks) on the usage of header-only c++ libraries

折月煮酒 提交于 2019-12-02 16:05:12
I've tried to find an answer to this using SO. There are a number of questions that list the various pros and cons of building a header-only library in c++, but I haven't been able to find one that does so in quantifiable terms. So, in quantifiable terms, what's different between using traditionally separated c++ header and implementation files versus header only? For simplicity, I'm assuming that templates are not used (because they require header only). To elaborate, I've listed what I have seen from the articles to be the pros and cons. Obviously, some are not easily quantifiable (such as

CMake: target_include_directories() prints an error when I try to add the source directory itself, or one of its subdirectories

最后都变了- 提交于 2019-11-30 10:39:21
问题 I am writing a C++ library (header-only) and am using CMake to generate my (Visual Studio) project and solution files. I'm also writing a test suite, which is part of the same CMake project. My problem occurs when I call target_include_directories() on the target that represents my header-only library, so that consumers of my library may find its header files. I get the following error message (even though generation is NOT aborted). CMake Error in CMakeLists.txt: Target "Fonts" INTERFACE

CMake: target_include_directories() prints an error when I try to add the source directory itself, or one of its subdirectories

萝らか妹 提交于 2019-11-29 21:30:18
I am writing a C++ library (header-only) and am using CMake to generate my (Visual Studio) project and solution files. I'm also writing a test suite, which is part of the same CMake project. My problem occurs when I call target_include_directories() on the target that represents my header-only library, so that consumers of my library may find its header files. I get the following error message (even though generation is NOT aborted). CMake Error in CMakeLists.txt: Target "Fonts" INTERFACE_INCLUDE_DIRECTORIES property contains path: "D:/Projects/GPC/fonts/include" which is prefixed in the