Should I use header-only classes or lib files?

I am creating an external library for general use. What Im asking is should I put every class in just .hpp files like boost does or should I compile it into a lib file and keep the two file per class rule. As far as I can see .hpp is used for speed, so you don't have to add a .lib for every class or a massive one for the whole thing and for cross-platform.

[edit] Whats your personal preference and why. My library would just be for my personal use. [edit] For statically linking the library

Answers


This really depends on if you have cross-platform or templated code. You may not have an awful lot of choice about making the majority in header files if you need a lot of preprocessing to generate it. Otherwise, you should pre-compile as much as possible, as a general rule.


For a class that is used in multiple compilation units (cpp-files) you will want to have as tiny header files as possible to keep down the build time. The bulk of your code should go into a cpp file.


Need Your Help

Java.io.FileOutputStream in Google App Engine

java google-app-engine

Why "FileOutputStream" is a restricted class in Google App Engine? Is there any other way to use the "FileOutputStream" in Google App Engine?

Return min and max number from range showing as text

javascript

I need to parse a table with prices range, but I've got stuck because prices range is showing as text only, and there is no id's or classes to identify them.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.