|
Boost : |
From: Andy Little (andy_at_[hidden])
Date: 2006-10-05 12:46:14
"Marcus Lindblom" <macke_at_[hidden]> wrote in message
news:45252C77.3050708_at_yar.nu...
> Jason Hise wrote:
>> For accessing members of a vector, I've found I prefer using an index
>> to access elements, with some special indicees predefined. This
>> sidesteps the problem of needing to directly access a member in order
>> to refer to a component by name. For instance:
>>
>> vector<int, 2> vec;
>>
>> vec[0] = 42;
>> vec[_x] = 42; // does the same thing
>>
> So, we need to support three different styles of access, at least, to
> make everyone happy?
>
> - vec[0]
> - vec.x
> - vec[_x]
Why not :
at_x(vec)
This allows all the above:
T vec[3]; // array boost array
and
at_c<0>(vec) // Fusion style
and Views:
http://spirit.sourceforge.net/dl_more/fusion_v2/libs/fusion/doc/html/fusion/sequences/views.html
regards
Andy Little
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk