|
Boost : |
Subject: Re: [boost] painless currying
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-08-26 16:24:46
on Fri Aug 26 2011, Larry Evans <cppljevans-AT-suddenlink.net> wrote:
> Since an n-dimensional array can be thought of as a function of
> n indexes, I would think then that subscripting multi-dimensional
> arrays would rub you the wrong way:
>
> int f[1][1][1];
>
> f[0] => doesn't return an int
> f[0][0] => doesn't return an int
> f[0][0][0] => *does* return an int
>
> Instead, would you prefer the following symmetrical version?
>
> f[0] => doesn't return an int
> f[0][0] => doesn't return an int
> f[0][0][0] => doesn't return an int
> f[0][0][0]() => *does* return an int
No, sorry, but that's just silly. Array indexing is entirely
consistent:
f[0] => returns int(&)[1][1]
f[0][0] => returns int(&)[1]
f[0][0][0] => returns int&
-- Dave Abrahams BoostPro Computing http://www.boostpro.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk