Boost logo

Boost-Build :

From: Rene Rivera (grafik666_at_[hidden])
Date: 2002-07-02 15:47:25


[2002-07-02] Rene Rivera wrote:

>[2002-07-02] Rene Rivera wrote:
>>[2002-07-02] Vladimir Prus wrote:
>>Hmmm... How about extending the "at" accessor to allow the dereferencing
>>directly like so:
>>
>>ECHO [ $(l).at 0 : 1 ] ; # >> 2
>>
>>That seems as simple a syntax, also looks like multi-dimensional arrays
:-)
>
>One other thought if that doesn't seem apporpriate for what you need... to
>do the unwrapping I'd add another accessor like this:
>
>l0 = [ $(l).get-at 0 ] ;
>ECHO $(l0[1]) ;
>
>A better name than "get-at" would be good though.

OK, both are implemented and tested now :-)

Couldn't think of a better name than get-at.

The "multi-dimensional" access is implemented on both the "at" and "get-at"
accessors so this is possible:

l = [ new list [ new list 1 2 3 [ new list a b c [ new list x y z ] ] ] ] ;
ECHO [ $(l).get-at 4 : 4 ] ; # >> x y z
ECHO [ $(l).at 4 : 4 : 2 ] ; # >> y

-- grafik - Don't Assume Anything
-- rrivera_at_[hidden] - grafik_at_[hidden]
-- 102708583_at_icq - Grafik666_at_AIM - Grafik_at_[hidden]

 


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk