Benefits of header-only libraries

前端 未结 5 1450
天涯浪人
天涯浪人 2020-11-28 01:46

What are the benefits of a header only library and why would you write it that way oppose to putting the implementation into separate file?

5条回答
  •  孤街浪徒
    2020-11-28 02:09

    The main "benefit" is that it requires you to deliver source code, so you'll end up with error reports on machines and with compilers you've never heard of. When the library is entirely templates, you don't have much choice, but when you have the choice, header only is usually a poor engineering choice. (On the other hand, of course, header only means that you don't have to document any integration procedure.)

提交回复
热议问题