Skip to content
/ sgl Public
forked from AlexDenisov/sgl

SGL - Swift Generic Library. Highly inspired by C++ STL.

License

Notifications You must be signed in to change notification settings

atermenji/sgl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 {
        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 

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.

About

SGL - Swift Generic Library. Highly inspired by C++ STL.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published