Besides the normal features that are activated automatically upon inclusion of the library, cxxomfort provides a varied set of features that are not enabled by default by any of a variety of reasons, mostly:

  • the syntax is too different from the C++11 native feature.
  • the feature is heavily compiler-dependent.
  • the feature is not standardized yet and/or present only as a proposal, at least up to C++14 (as of May 2015).

In order to use these features, the specific header must be #include'd explicitly. These headers live in the extras/ subdirectory.

Last update of this listing: May 2015

List of Features

(In alphabetical order)

"assert" variants

Auto/Decltype Emulation

Header: cxxomfort/extras/auto.hpp .
Macro: if enabled, CXXOMFORT_USING_auto is defined.

This header adds the following macros:

CXXO_AUTO( variablename, expr )

The above macros allow for emulation of C++11's new "auto" and "decltype" semantics if the compiler supports an equivalent semantic such as typeof in C++03 mode (as GCC's __typeof__). Usage is very simple:

typdef std::list<short> SHL_t; // short-list type
SHL_t shl;
CXXO_AUTO (M, shl.size() );
// M is automatically declared as eg.: an unsigned int in this case
cout<< M<< endl;

In C++11, the macros extend simply to auto variablename = expr and decltype(expr) respectively.

In C++03, the macros extend to a compiler-supported "typeof" invocation; if none is available, compilation fails with an error messaage of "typeof not supported".


  • In non-C++11 mode, the compiler must support a keyword like __typeof__.

Known Limitations:

  • This feature works in Microsoft C++ ≥ 8.0 thanks to a combination of documented hacks for typeof emulation; however, in this case it can not be used in all the contexts a normal __typeof__ can, so use with caution.
  • When in C++03 mode, remember "typeof" intrinsics may not resolve reference types the same way C++11's decltype does.

Scoped Enumerations

(to be completed)

»Possible Future Features

I'm considering adding some features that are either from C++11 or from current proposals for TR2 / C++2x and that are easy enough and useful enough to have them implemented in this library. No more details at the moment though.

In consideration at the moment of this writing:

  • default-value-initialized wrapper (from Boost).
  • "degenerate" (primitive type + singular term) proposal.
  • tuple<> output to streams.
  • C++14's scoped_resource proposal.
  • A tuple invoke function.
  • begin/end for typesafe enumeration types.
  • is_swappable
  • Fixed-time calculation versions for equal, mismatch and the find_* family of algorithms.