A library is a collection of functions and classes.
Libraries that you should familiarize with are [1,2,10]:
- STL: Standard Template Library: the C++ standard library
- The Boost libraries: new functionality that is not (yet) in the STL
- GSL: Guidelines Support Library: functionality to adhere to the C++ Core Guidelines
There are two ways to build a library:
- shared library (also called 'dynamic library')
- static library
libraries can be catagorized by their way of using them in a project:
- Header-only libraries: just #include the header files to use it
- Implementation file (.cpp) must be added to the project, next to an #include of the header files to use
The STL is header-only. Most Boost libraries are header-only.
- A library doesn't have to be large or complicated to be useful [8]
- Familiarize yourself with the STL and Boost libraries [1,2]
- Prefer using libraries over hand-crafted code [3,5]
- A library shouldn't unilaterally terminate a program, but throw an exception instead [6]
- A library shouldn't produce diagnostic output aimed at an end user, but throw an exception instead [7]
In practice, these are the libraries I use or have used, on the platforms indicated by the pictograms.
- ALGLIB: scientific computation
- Annie: neural networks
- apfloat: arbitrary precision numbers
- BigInt: near-infinite size integer
- Blitz++: scientific computation
- Boost: many libraries, next STL
- Boost.Accumulators: incremental calculation, statistical accumulators [4]
- Boost.Algorithm: algorithms [4]
- Boost.Any: Safe, generic container for single values of different value types [4]
- Boost.Array: STL compliant container wrapper for arrays of constant size [4]
- Boost.Asio: Portable networking [4]
- Boost.Assign: Filling containers [4]
- Boost.Atomic: C++11-style atomic<> [4]
- Boost.Bimap: Bidirectional maps [4]
- Boost.Bind: binders
- Boost.Call Traits: Defines types for passing parameters [4]
- Boost.Chrono: time utilities [4]
- Boost.Circular Buffer: Circular/ring/cyclic buffer [4]
- Boost.Compatibility: Help for non-conforming standard libraries [4]
- Boost.Compressed Pair: Empty member optimization [4]
- Boost.ConceptCheck: Tools for generic programming [4]
- Boost.Container: Standard library containers and extensions [4]
- Boost.Context: Context switching library [4]
- Boost.Conversion: Polymorphic and lexical casts [4]
- Boost.Coroutine: Coroutine library [4]
- Boost.CRC: Cyclic Redundancy Code [4]
- Boost.Date_Time: date and time [4]
- Boost.Dynamic_bitset: dynamic_bitset [4]
- Boost.Enable_if: Selective inclusion of function template overloads [4]
- Boost.Exception: The Boost Exception library [4]
- Boost.Filesystem: The Boost Filesystem Library [4]
- Boost.Flyweight: Flyweight Design Pattern [4]
- Boost.Foreach: BOOST_FOREACH [4]
- Boost.Format: text formatting [4]
- Boost.Function: callbacks [4]
- Boost.FunctionTypes: function to member types [4]
- Boost.Functional: function object wrappers [4]
- Boost.Functional/Factory: dynamic and static object creation [4]
- Boost.Functional/Forward: allow generic function objects to accept arbitrary arguments [4]
- Boost.Functional/Hash: A TR1 hash function object [4]
- Boost.Functional/Overloaded Function: Overload different functions into a single function object [4]
- Boost.Fusion: Library for working with tuples, including various containers, algorithms, etc. [4]
- Boost.Geometry: Geometry Library [4]
- Boost.GIL: Generic Image Library [4]
- Boost.Graph: Graph [4]
- Boost.Heap: Priority queue data structures [4]
- Boost.ICL: Interval Container Library [4]
- Boost.Identity Type: Wrap types within round parenthesis so they can always be passed as macro parameters [4]
- Boost.In Place Factory, Typed In Place Factory: Generic in-place construction of contained objects with a variadic argument-list [4]
- Boost.Integer: Access standard integer types without placing any names in namespace std [4]
- Boost.Interprocess: Shared memory, memory mapped files, process-shared mutexes, condition variables, containers and allocators [4]
- Boost.Interval: Extends the usual arithmetic functions to mathematical intervals [4]
- Boost.Intrusive: Intrusive containers and algorithms [4]
- Boost.IO State Savers: I/O library [4]
- Boost.Iostreams: Framework for defining streams [4]
- Boost.Iterator: Iterator [4]
- Boost.Lambda: Lambda functions
- Boost.Lexical Cast: text conversions [4]
- Boost.Local Function: Program functions locally, within other functions, directly within the scope where they are needed [4]
- Boost.Locale: Provide localization and Unicode handling tools for C++ [4]
- Boost.Lockfree: Lockfree data structures [4]
- Boost.Math: Math [4]
- Boost.Math Common Factor: Greatest common divisor and least common multiple [4]
- Math Octonion: Octonions [4]
- Boost.Math Quaternion: Quaternions [4]
- Boost.Math/Special Functions: Mathematical special functions [4]
- Boost.Math/Statistical Distributions: Statisticals
- Boost.Member Function: Generalized binders for function/object/pointers and member functions [4]
- Boost.Meta State Machine: A very high-performance library for expressive UML2 finite state machines [4]
- Boost.Min-Max: Standard library extensions for simultaneous min/max and min/max element computations [4]
- Boost.Move: Portable move semantics for C++03 and C++11 compilers [4]
- Boost.MPI: Message Passing Interface library, for use in distributed-memory parallel application programming [4]
- Boost.MPL: Compile-time Metaprogramming Library
- Boost.Multi-Array: N-dimensional array [4]
- Boost.Multi-Index: container maintaining one or more indices with different sorting and access semantics [4]
- Boost.Multiprecision: Extended precision arithmetic types for floating point, integer andrational arithmetic [4]
- Boost.Numeric Conversion: Optimized Policy-based Numeric Conversions [4]
- Boost.Odeint: Solving ordinary differential equations [4]
- Boost.Operators: Templates ease arithmetic classes and iterators [4]
- Boost.Optional: Discriminated-union wrapper for optional values [4]
- Boost.Parameter: Boost.Parameter Library - Write functions that accept arguments by name [4]
- Boost.Phoenix: Define small unnamed function objects at the actual call site, and more [4]
- Boost.Pointer Container: Containers for storing heap-allocated polymorphic objects [4]
- Boost.Polygon: Booleans/clipping, resizing/offsetting and more for planar polygons with integral coordinates [4]
- Boost.Pool: Memory pool management [4]
- Boost.Preprocessor: Preprocessor metaprogramming tools including repetition and recursion [4]
- Boost.Program_options: parse program options
- Boost.Property Map: Concepts defining interfaces which map key objects to value objects [4]
- Boost.PropertyTree: saving data to XML file, parsing XML files
- Boost.Proto: Expression template library and compiler construction toolkit [4]
- Boost.Python: interfacing Python and C++ [4]
- Boost.Random: A complete system for random number generation [4]
- Boost.Range: generic algorithms that builds on top of the new iterator concepts [4]
- Boost.Ratio: Compile time rational arithmetic [4]
- Boost.Rational: A rational number class [4]
- Boost.Ref: A utility library for passing references to generic functions [4]
- Boost.Regex: Regular expression library [4]
- Boost.Result Of: Determines the type of a function call expression [4]
- Boost.Scope Exit: Execute arbitrary code at scope exit [4]
- Boost.Serialization: Serialization for persistence and marshalling [4]
- Boost.Signals: Managed signals < slots callback implementation [4]
- Boost.Signals2: Managed signals < slots callback implementation (thread-safe version 2) [4]
- Boost.Smart_ptr: smart pointers
- Boost.Spirit: LL parser framework represents parsers directly as EBNF grammars in inlined C++ [4]
- Boost.Statechart: finite state machines
- Boost.Static Assert: Static assertions (compile time assertions) [4]
- Boost.String Algo: String algorithms library [4]
- Boost.Swap: Enhanced generic swap function [4]
- Boost.System: Operating system support [4]
- Boost.Test: Support for simple program testing, full unit testing, and for program execution monitoring [4]
- Boost.Thread: Portable C++ multi-threading [4]
- Boost.Timer: Event timer, progress timer, and progress display classes [4]
- Boost.Tokenizer: Break of a string or other character sequence into a series of tokens [4]
- Boost.TR1: TR1 library
- Boost.Tribool: 3-state boolean type library [4]
- Boost.Tuple: Tuple
- Boost.Type Traits: Templates for fundamental properties of types [4]
- Boost.Typeof: Typeof operator emulation [4]
- Boost.uBLAS: Matrices [4]
- Boost.Units: Zero-overhead dimensional analysis and unit/quantity manipulation and conversion [4]
- Boost.Unordered: Unordered associative containers [4]
- Boost.Utility: noncopyable, checked_delete(), checked_array_delete(), next(), prior() function templates, plus base-from-member idiom [4]
- Boost.Uuid: A universally unique identifier [4]
- Boost.Value Initialized: Wrapper for uniform-syntax value initialization [4]
- Boost.Variant: Safe, generic, stack-based discriminated union container [4]
- Boost.Wave: C++ implementation of the mandated C99/C++ preprocessor functionality [4]
- Boost.Xpressive: Regular expressions allowing context-free grammars [4]
- Box2D: 2D physics engine
- Bullet: 3D physics engine
- CLN: arbitrary precision numbers
- CLX: GUI
- Eo: genetic algorithms
- FANN: neural networks
- Flood: neural networks
- GAlib: genetic algorithms
- GMP: multi-precision numbers
- GMTL: scientific computation
- GSL: GNU scientific library
- HFLOAT: arbitrary precision numbers
- Irrlicht: 3D engine
- libnds: working with NDS
- MathGL: visualizing data
- NAG: algorithms
- ODE: Open Dynamics Engine, 3D physics engine
- OGRE: 3D engine
- OpenCL: communication with CPU's, GPU's and other processors
- OpenCV: computer vision
- OpenGL: 2D and 3D graphics
- Open Inventor: 3D graphics
- OpenSceneGraph: 3D graphics
- Panda3D: 3D graphics
- Poppler: render PDFs
- QuantLib: quantitative finance
- Triangle: two-dimensional mesh generator and Delaunay triangulator
- QT: GUI
- Qwt: visualizing data in 2D charts/plots
- QwtPlot3D: visualizing data in 3D charts/plots
- SDL: multimedia
- SFML: 2D graphics
- Shark: machine learning
- STL: general purposes
- STK: audio
- Urho3D: 3D graphics
- VCL: GUI
- Visualization Library: 3D graphics
- Wt: dynamic websites
- [1] Scott Meyers. Effective C++ (3rd edition). ISBN: 0-321-33487-6. Item 53: Familiarize yourself with the standard library, including TR1
- [2] Scott Meyers. Effective C++ (3rd edition). ISBN: 0-321-33487-6. Item 54: Familiarize yourself with Boost
- [3] Bjarne Stroustrup. Programming. 2009. ISBN: 978-0-321-54372-1. Chapter 5.9.1: 'Use library facilities rather than your own code when you can'
- [4] Boost documentation
- [5] Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Page 32, 1.5 'Advice', item 12: 'Use libraries, especially the standard library, rather than trying to build everything from scratch'
- [6] Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 13.7. Advice. page 387: '[34] A library shouldn't unilaterally terminate a program. Instead, throw an exception and let a caller decide'
- [7] Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 13.7. Advice. page 387: '[35] A library shouldn't produce diagnostic output aimed at an end user. Instead, throw an exception and let a caller decide'
- [8] Bjarne Stroustrup. A tour of C++. 2014. ISBN: 978-0-321-958310. Chapter 11.7.2, page 131: 'A library doesn't have to be large or complicated to be useful'
- [9] C++ Core Guidelines: SL.2: Prefer the standard library to other libraries
- [10] C++ Core Guidelines: P.13: Use support libraries as appropriate