cycle

 
// return type : Iterator
Iterator::cycle : method();

Description

イテレートする要素がなくなったら最初からイテレートしなおすイテレータを返します。

Example

0,1,2,0,1,2,… となるイテレータのうち、最初の10個を出力する

C++

Xtal

(0..2).cycle.take(10){
    it.p;
}

Output

0
1
2
0
1
2
0
1
2
0
reference/iterator/cycle.txt · 最終更新: 2011/07/16 10:42 by sukai
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0