|
Boost : |
From: Glen Fernandes (glen.fernandes_at_[hidden])
Date: 2020-01-24 16:10:01
Alexander wrote:
> So if T[] and T[N] are valid, then T[N][M] should also be. This increases
the scope greatly but has an incredible difficult questions to answer: What
would operator[] return? I don't have a good answer...
Simple questions that already have an answer:
The same way shared_ptr<T[N][M]> works today. :)
Its operator[] returns element_type&
So:
auto p = allocate_shared<int[5][1024]>(alloc);
p[3][675] = 8;
auto q = allocate_unique<double[][2][3][4]>(alloc, size);
q[index][1][1][1] = 0.95;
Then:
dynamic<int[5][1024], Allocator> a(alloc);
a[3][675] = 8;
i.e. Making it work for T[N] also automatically makes it work for T[N][M].
Glen
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk