How to get the C++ standard

The C++ standard is the definitive source for the language. The committee that works on the C++ standard is called the C++ Standards Committee or Working Group 21 or WG21 for short. All information about this committee is shared at the WG21 website.

WG21 regularly reviews changes to the standard and accepts them for addition to the next standard. These commits are available as drafts that the committee shares to the public for free. However, at a certain magical commit, the committee accepts the last few changes on top of a publicly released draft and blesses that as the new standard. However, the official standard is only available through the ISO for a fee.

Historical drafts of the standard that come from WG21 or the latest draft from WG21 are not of interest to most C++ programmers. What is useful for most folks are the official standards. But, those are not free. So, what folks typically do is to grab the last draft before a standard that they are interested in.

For example, assume I have access to only a C++11 compiler and I witness a compilation anomaly. I would be interested in consulting the last draft before the C++11 standard.

WG21 provides a handy redirection service at wg21.link to obtain all sorts of documents are generated by the committee.

Drafts of standards

The redirection links that can be used to download draft PDFs relevant to C++ standards are:

Build draft from source

The latest draft standard can be compiled from its LaTeX source to PDF for free:

  • Install these LaTeX packages:
$ sudo apt-get install latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
  • Clone the C++ draft standard repository:
$ git clone git@github.com:cplusplus/draft.git
  • Build a PDF of the standard:
$ cd source
$ latexmk -pdf std

If there are too many warnings, you might need to run the above command a second time. The result is a PDF of the C++ standard!

Advertisements