This simple code
import sgl
func print_array<T, S: iterator_strategy_protocol>(begin: forward_iterator<T, S>, end: forward_iterator<T, S>) {
var it = begin
while it != end {
print("\((it++).value()!)")
print(" ")
}
println()
}
var a = array<Int>(1, 2, 3, 4, 5)
print_array(a.begin(), a.end())
print_array(a.rbegin(), a.rend())
will print
1 2 3 4 5
5 4 3 2 1
- array
- vector
- deque
- list
- forward_list
- set
- multiset
- unordered set
- map
- multimap
- unordered map
- stack
- queue
- priority queue
- input iterator
- output iterator
- forward iterator
- bidirectional iterator
- random access iterator
to be added
to be added
The source code distributed under MIT license. See LICENSE for details.