Boost logo

Boost :

From: Maximilian Riemensberger (riemaxi_at_[hidden])
Date: 2022-06-02 09:00:37


Hi Julien,

On 6/2/22 07:57, Julien Blanc via Boost wrote:
> Hi,
>
> I've written and released a (rather small) library which allows
> defining arrays with arbitrary index mechanisms (hence the name,
> indexed_array). This especially allows indexing with scoped enums, use
> non zero-starting indexes, or use sparse indexes. This is not a view,
> but an array in the sense that it owns the data, and provides the same
> guarantees and functionalities as std::array, such as triviality
> propagation, being able to reside in read-only program sections, etc.
>
> It also supports multidimensional indexing, and provides an
> indexed_span template class to access lower dimension content (which
> can be used outside indexed_array).
>
> Finally, it provides an opt-in safer way to initialize the array
> content, which is especially useful when using complex and/or changing
> indexing schemes (like based on externally generated files).

The library looks very interesting. I think I could be very useful for defining custom error codes (enums) and their mapping to custom error strings. This is relatively simple with a std::array if the codes are contiguous and starting from 0. Your library would make it as easy for arbitrary code values, like http codes. Very useful.

>
> The library is available here:
>
> https://github.com/Julien-Blanc-tgcm/indexed_array
>
> And the doc is here:
>
> https://julien-blanc-tgcm.github.io/indexed_array/
>
> It requires C++17 and mp11, and has first-class support for describe-d
> enums.

Is there a particular reason to require c++17? I guess some std::array features that got added? I would assume that it should be possible to make it compile under C++14 (maybe using some boost array) since most constexpr things should already be available there.

>
> If there is some interest, i'd like to propose it for inclusion in
> boost. So i'm looking for people who would endorse it.

I endorse it.

Thanks for sharing.

Best,
Max

>
> Thanks and best regards,
>
> Julien
>
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk