Home

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
Iterators
Algorithms

to be added

Numerics

to be added

License

The source code distributed under MIT license. See LICENSE for details.