|
Boost : |
Subject: Re: [boost] painless currying
From: Agustín K-ballo Bergé (kaballo86_at_[hidden])
Date: 2011-08-26 18:56:48
On 26/08/2011 15:04, Larry Evans 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
>
> -regards,
> Larry
>
Now that you mention this, I have considered the same issue currently
being discussed when trying to implement a multi-dimensional subscript
operator facade. Initially I started invoking the function as soon as
there were enough arguments (using Eric's technique); but then I
considered several overloads with different number of arguments and the
only solution I could came with was invoking the underlying function on
a conversion operator, which would do more harm than good (specially
considering C++0X auto). Eventually I simply had to discard this use
case scenario. Then for curried functions, explicit invocation via ()
seems like a viable solution to the problem.
Agustín K-ballo Bergé.-
http://talesofcpp.blogspot.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk