Single-header libraries from the Magnum engine
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

This repository contains single-header libraries from the Magnum engine.

Join the chat at Build Status MIT License


There are the following single-header libraries at the moment. This list will grow with more Magnum features being exposed this way.

Library LoC PpLoC(*) Description
CorradeOptional.h 328 2742 Containers::Optional, a lightweight alternative to std::optional
CorradePointer.h 259 2321 Containers::Pointer, a lightweight alternative to std::unique_ptr
CorradeReference.h 115 1639 Containers::Reference, a lightweight alternative to std::reference_wrapper
CorradeScopeGuard.h 108 26 Containers::ScopeGuard, a lightweight alternative to std::unique_ptr with a custom deleter

(*) — lines of code after a preprocessor run, with system includes expanded. Gathered using GCC 8.2 and libstdc++.

Where is the documentation?

Single-header libraries provided here are generated from multi-file sources in the Magnum project. This is done for two reasons — first, documentation and test coverage is much easier to maintain in the setting of a bigger project, avoiding any redundancy or duplicated efforts. Second, because the resulting files are generated with non-essential parts stripped away, there's no need to worry about bloating them due to original implementations having extensive documentation or rarely used features.

With the goal being easy integration, the files are deliberately free of all comments and documentation blocks to keep their size small. Documentation for each library is provided in the official Magnum documentation, linked from the table above. Each library file contains the same documentation link, together with a concrete Git revision it was generated from a changelog for a few versions back for easier overview when updating.

For more information read the single-header library docs. The libraries are generated using, which is part of Corrade. See its documentation, if you are interested. Particular libraries are introduced on the Magnum blog:

What about test coverage?

Testing done in this repository is mainly to ensure the libraries are generated correctly. Extensive testing on variety of compilers and OSes with > 99% test coverage is done in the Magnum Project itself. See the Build Status page for more information.

Reporting bugs and contributing

As always, bug reports, feature requests and code contributions are very welcome. However again please note the files in this repository are generated from original sources in the corrade and magnum repositories, meaning that ideally all PRs should go there instead, as there's a better infrastructure for documentation and testing. We don't enforce this rule though — if you have an important bugfix, it's better if you submit it here than not at all 😉


All libraries are tested on these platforms:

And on these compilers:

  • GCC 4.8.1 and newer (and equivalent MinGW-w64 version)
  • Clang 3.3 and newer (and equivalent AppleClang version), both libstdc++ and libc++
  • MSVC 2015 and newer


See also the Magnum Project Contact & Support page for further information.


Libraries presented here are a result of a dedicated work by many community members. List of all contributors to the Magnum Project can be found in the documentation.


Magnum is licensed under the MIT/Expat license, see the COPYING file for details.