Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
Prev Up HomeNext

Constexpr domain source

Back in The constructor, we declared but did not implement a .get() function which returns a constexpr static instance of the domain. We implement this now:

// 100% constexpr instantiation
constexpr _file_io_error_domain file_io_error_domain;
inline constexpr const _file_io_error_domain &_file_io_error_domain::get()
{
  return file_io_error_domain;
}
View this code on Github

As this is 100% constexpr, it can be (and is under optimisation) implemented entirely in the mind of the compiler with no run time representation.

Last revised: January 26, 2019 at 23:38:56 UTC


Prev Up HomeNext