Boost logo

Boost :

Subject: Re: [boost] [array] Support for multidimensional arrays?
From: Peter Dimov (lists_at_[hidden])
Date: 2015-05-05 20:43:58


David Stone wrote:

> The one main design decision for a multi-dimensional array is what begin()
> and end() iterate over: int, or array<int, 4, 5>?

They iterate over int[4][5] in my suggestion.

This is, admittedly, not a "true" multidimensional array, it's just how C
arrays work.

    int a[3][4][5];

    for( auto& x: a )
    {
        // x is int (&)[4][5] here
    }

This is consistent with begin() returning T* == int(*)[4][5] and op[]
returning T& == int(&)[4][5].


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