cxxomfort
rel.20211024
Simple backports for C++ - https://ryan.gulix.cl/fossil.cgi/cxxomfort/
|
Backports related to Standard header <array>
Including the header brings up std::array
, accounting for eg.: location being std::tr1::array
where set up in C++03+TR1.
If no TR1 is found and the user has defined the macro CXXOFLAG_USE_INTERNAL_TR1
, cxxomfort uses this header to provide its own implementation of array
.
An std::array
is much like a native C-array in that it has a type and size set up at compile time, but it also adds an interface similar to most of C++'s sequence containers: it has a begin/end
, an iterator
type, and accepts indexing of elements via the operator[]
.
Interfaces defined in this section:
std::array
(C++11) for compilers that don't have eg.: C++03/TR1.std::to_array()
(C++20) - converts native arrays to std::array
.make_array()
(exp) - creates std::array
from a list of arguments.Interfaces from TR1 repointed in this section:
get(std::array)Interfaces not in std:
to_cxxo_array()
- converts native arrays to cxxomfort::array
.This header also makes available cxxomfort's implementation of array, found at cxxomfort::array
. This implementation differs from std mainly in enabling some constexpr
-capable member functions in compilers that were capable but the stdlib did not mark array so, such as modifying operator[]
in C++14.
For other examples see the following entries in cxxomfort-examples:
array.cpp
: usage of array and related functions.algorithms_constexpr.cpp
: usage of cxxomfort::array
in constexpr context.array_ref
array
. make_array
.std::array
from a native C array. experimental/lfv2
) experimental/lfv2
)