Documenting the CPH MPL—release 2—by code
Author:Jyrki Katajainen
Publication:CPH STL report 2020-1, Department of Computer Science, University of Copenhagen (2020), 109 pp.
Full text:<pdf.gif>PDF (685 kB)  
Abstract:In C++20, the definitions of function templates and class templates can be supplemented by a set of constraints that template arguments have to fulfil before the templates will be instantiated. To specify such constraints, we need a rich set of type predicates, type attributes, and type functions that can be evaluated at compile time. Such computations are called metaprograms; they are executed by the compiler during the compilation when generating the run-time code.

In this document, we publish the source code of the CPH MPL, Copenhagen metaprogramming library (release 2), which provides a wide variety of metaprograms. We had a strong urge to release this package because

  • we find the use of the tools convenient; maybe others also want to use them;
  • the tools must be reviewed and used by others to get rid of some hard-to-find errors that are unavoidable for a package of this size; thus, any constructive user feedback would be valuable for us;
  • the tools are used in some of our other packages, so the users of these packages will need this package, too;
  • the tools have a clear developmental value; they show some shortcomings in the facilities available at the C++ standard library; possibly this will lead to improvements there as well;
  • the tools have some pedagogical value; by reading the source code it should be easier for others to write their own metaprograms.

The CPH MPL was developed in parallel with the CPH STL class templates designed for the manipulation of multiple-precision integers. Basically, only tools that were needed by this application were programmed. The reader should have this limitation in mind.

Related:<html.gif>HTML (First write-up)  <html.gif>HTML (Technical report)  <zip.png>ZIP (Release 1)  <zip.png>ZIP (Release 2)  
  author = {Jyrki Katajainen},
  title = {Documenting the CPH MPL---release 2---by code},
  type = {CPH STL report},
  number = {2020-1},
  institution = {Department of Computer Science, University of Copenhagen},
  year = {2020},
  pagetotal = {109},
This page was generated by Jyrki Katajainen <> on 2020-05-12.