Artifact 78d143bb9b8be81ca5373a58fbca728a5e97c070e7d9f848e8a08963858d2ead:

Wiki page [Extras] by luismachuca 2019-01-06 21:01:16.
D 2019-01-06T21:01:16.958
L Extras
P d4f085ae2e3f0392a69bab4e4072e4405af88f58c8847e6782e6f4a497869e3d
U luismachuca
W 4491
Besides the [Features|normal features] that are activated automatically upon inclusion of the library, as well as the [Supplements], there are a number of side-projects that don't count as part of <b>cxxomfort</b>'s distribution proper. They are being developed separately and rather than integrate with cxxomfort tightly they just depend on the library as a whole.

The idea is to pick a number of features, proposals or general C++ concepts and implement them separately. There are a number of reasons to tackle these features separately:

  *  the syntax to implement them is too different to C++'s normal syntax (heavy macros, etc) or is too heavy.
  *  the feature is more advanced or convoluted and benefits from being decoupled from most cxxomfort internals.
  *  the feature is heavily compiler-dependent.
  *  the feature is not standardized yet and/or present only as a proposal.

In order to use these features, they can be cloned or downloaded from their specific repositories.

<em>Last update of this listing: November 2018</em>

<h2>List of Extras</h2>

  *  <b>[https://notabug.org/lmachucabezzaza/cxxo-literal_affixes|cxxo-literal_affixes]</b> - An emulation of C++11's suffix user-defined literals, that also work as normal function objects.
  *  <b>[https://chiselapp.com/user/lmachucab/repository/cxxo-vocabulary17/home|cxxo-vocabulary17]</b> - An external component for the library that adds support for <tt>std::optional</tt>, <tt>std::variant</tt> and <tt>std::any</tt>, the new "vocabulary types" added in C++17.
  *  cxxo-static_storage - A storage for types that makes them act as "literal" types like ints: objects are never destructed during the program's lifetime, and references/handles to them are passed around instead.
  *  cxxo-auto - Backporting <tt>auto</tt> in a limited manner.
  *  cxxo-udl - An implementation of suffix user-defined literals, simpler than the one above.
  *  cxxo-minrange - A minimalistic <tt>std::range</tt> proposal built around n3350 "A minimal std::range".
  *  cxxo-tuple_io - Stream output operators for <tt>std::tuple</tt> .


<hr/>
<h2>Descriptions</h2>

<h3><a name="cxxo-auto"></a>Auto/Decltype Emulation</h3>

Header: <code>cxxomfort/extras/auto.hpp</code> . <br/>
Macro: if enabled, <code>CXXOMFORT_USING_auto</code> is defined.

This header adds the following macros:

<pre>
CXXO_AUTO( variablename, expr )
CXXO_DECLTYPE( expr )
</pre>

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 <code>__typeof__</code>). Usage is very simple:

<pre>
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;

</pre>

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

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


<b>Requirements</b>:

  *  In non-C++11 mode, the compiler must support a keyword like <tt>__typeof__</tt>.

<b>Known Limitations</b>:

  *  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 <code>__typeof__</code> 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.

<hr/>
<h2><a name="future">»</a>Possible Future Features</h2>

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.
  *  begin/end for typesafe enumeration types.
  *  Fixed-time calculation versions for <code>equal</code>, <code>mismatch</code> and the <code>find_*</code> family of algorithms.

<hr/>

  *  Back to [Features|Main Features Documentation].
  *  [Implementation Status] for C++ proposals.
  *  [Cxxomfort|Back to the beginning].


Z 64e53bb4acb7269d51aa26d373bf36f3