eXtended Template Library
Clone or download
Latest commit 774335e Dec 22, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets . Sep 14, 2017
docs fix various uninitialized members during construction. fix various id… Sep 15, 2017
examples .. Dec 22, 2018
include/xtd .. Dec 22, 2018
src . Sep 29, 2017
tests .. Dec 22, 2018
utils add scowl_importer Sep 1, 2016
.drone.yml fix to misspelled file Jul 27, 2016
.gitattributes minor housekeeping Aug 17, 2016
.gitignore fix various uninitialized members during construction. fix various id… Sep 15, 2017
.gitmodules fix submodules Aug 25, 2016
.travis.yml prefix all XTL cmake macros with XTD_ May 22, 2018
CMakeLists.txt .. Dec 22, 2018
LICENSE.md . Dec 30, 2016
README.md disable event trace in linux for now Aug 27, 2017
index.html add index.html Jul 12, 2016


eXtended Template Library

Open Hub Open Hub project report
Linux Travis
Windows AppVeyor
Coverage Coveralls
Technical Debt SonarQube Tech Debt
Code Quality SonarQube Quality Gate
License Boost License
Contribute with Gratipay Gratipay User
Contribute with Beerpay Beerpay

View the documentation online at http://djmott.github.io/xtl

View the github project at https://github.com/djmott/xtl

XTL is a series of C++ template metaprogramming patterns, idioms, algorithms and libraries that solve a variety of programming tasks. It supplements, extends and cooperates with the STL by providing some frequently used components that are otherwise absent from the standard. A short list of some of the more notable headers:

Header Description
callback.hpp single producer notifies multiple consumers of an event
dynamic_library.hpp load and invoke methods in a dynamic library
parse.hpp text parsing and AST generation
socket.hpp general purpose socket communication
source_location.hpp maintains info about locations within source code
spin_lock.hpp simple user mode spin lock based on std::atomic
string.hpp advanced and common string handling
tuple.hpp manipulate and generate tuples
unique_id.hpp global unique identifier / universal unique identifier data type
var.hpp multi-type variant using type-erasure

Getting started

XTL works with modern C++11 compilers and has been tested with MinGW, GCC, Intel C++, Cygwin and Microsoft Visual C++. The library can be used out-of-the-box in many cases by simply including the desired header since most components are header-only. A few components require linking to a run-time component so they will need to be compiled.


  • CMake is required to configure
  • libiconv is optional for unicode support on Posix platforms.
  • libuuid is optional for UUID/GUID support on Posix plaforms. (This library has bounced around to several locations over the years. Some documentation says it's included in modern Linux kernel code while others say it's included in the e2fsprogs package. Most modern Linux distros support some version in their respective package managers.)


XTL is hosted on GitHub and is available at http://www.github.io/djmott/xtl Checkout the repo with git:

git clone https://github.com/djmott/xtl.git


For the most part XTL is a 'header-only' library so compilation isn't necessary. None the less, it must be configured for use with the compiler and operating system with CMake. From within the top level directory:

mkdir build
cd build
cmake ..

The compilation step is not always necessary depending on the required components that will be used. The method used to compile the run-time code is platform, toolchain and CMake configuration specific. For Linux, Cygwin and MinGW make files just run make.


Several configuration options are available during configuration with CMake. For most purposes the default configuration should work fine. Applications should add the include folder to the search path. The configuration with CMake detects the compiler toolchain and target operating system then produces the primary include file. For most applications just including the project header will go a long way:

 #include <xtd/xtd.hpp>


XTL uses the Google Test framework for unit tests and system test. From within the build directory:

make unit_tests

The unit tests and system tests are contained in the same resulting binary at tests/unit_tests. The coverage_tests build target is only available for GCC:

make coverage_tests

This will produce the binary tests/coverage_tests which is identical to the tests/unit_tests binary but has additional instrumenting enabled for gcov.


Online documentation is available at https://djmott.github.io/xtl and Doxygen is used to generate offline documentation. The code is fairly well marked up for doxygen generation. After the project has been configured with CMake build with documentation with:

make docs

This will extract the source comments and generate nice documentation in the docs/html folder. Also available is the wiki

Feedback and Issues

Submit a ticket on GitHub if a bug is found. Effort will be made to fix it ASAP.


Contributions are appreciated. To contribute monitarilty, toss me some cash on Beerpay or Gratipay To contirube code, fork the project, add some code and submit a pull request. In general, contributions should:

  • Clear around %80 in code coverage tests
  • Pass SonarQube quality gateway
  • Pass unit and system tests
  • Pass tests through ValGrind memcheck or some other dynamic analysis with no resource leaks or other significant issues


XTL is copyright by David Mott and licensed under the Boost Version 1.0 license agreement. See LICENSE.md or http://www.boost.org/LICENSE_1_0.txt for license details.

Support on Beerpay

Hey dude! Help me out for a couple of 🍻!

Beerpay Beerpay