Boost logo

Boost :

From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2022-01-02 12:44:57


On 1/2/22 13:03, Ivan Matek wrote:
> Update on update:
> John showed me that all what we need is more cowbe...  I mean curlies. :)
>     arr<int, 3, 2> a2_nested_init{ {{ {{1,2}}, {{3,4}},{{5,6}} }} };
> https://godbolt.org/z/Kzs6xbo5T <https://godbolt.org/z/Kzs6xbo5T>
>
> In my opinion this is very ugly since end users will just get angry and
> frustrated and switch to something else most of the time, but at least
> it seems equally ugly as nested std::array, so no "regression".

I didn't think about the recursion approach, so I suppose you can have a
generic implementation. Though it would seem it should be rather
expensive in terms of compile times. Here's a prototype:

https://godbolt.org/z/sj1Trs1TE

It would need more work if you want references and iterators to work in
terms of arr<> and not the built-in arrays.


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