Awesome
SGL - Swift Generic Library. Highly inspired by C++ STL
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 {
let value = (it++).value()!
print("\(value) ")
}
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
TODO
Containers
- array
- vector
- deque
- list
- forward_list
- set
- multiset
- unordered set
- map
- multimap
- unordered map
- stack
- queue
- priority queue
Iterators
- input iterator
- output iterator
- forward iterator
- bidirectional iterator
- random access iterator
Algorithms
to be added
Numerics
to be added
License
The source code distributed under MIT license. See LICENSE for details.