Кстати, если к containerEnumerator добавить один метод:
X++:
public container enumerate()
{
return [idx, conpeek(con, idx)];
}
то можно имитировать Python - ий enumerate():
X++:
items = ['a','b']
for i,thing in enumerate(items):
print 'index',i,'contains',thing
То есть, вместо громоздкого:
X++:
int idx;
;
while(enumerator.moveNext())
{
idx++;
value = enumerator.current();
}
писать изящное:
X++:
int idx;
;
while(enumerator.moveNext())
{
[idx, value] = enumerator.enumerate();
}