3a52c21f5c
generic algorithms for Objective-C
21 lines
1.3 KiB
Text
21 lines
1.3 KiB
Text
ObjectiveLib provides two primary services: containers and algorithms. An
|
|
important part of the library that keeps everything moving is iterators.
|
|
Iterators perform two functions: they provide access to elements stored in
|
|
containers and they provide a way for generice algorithms to operate on
|
|
elements of almost any type of container. Algorithms take iterators as
|
|
arguments, and thus never have any knowledge of what type of container
|
|
they happen to be affecting.
|
|
|
|
ObjectiveLib is designed to offer the same functionality to Objective-C
|
|
programmers that the Standard Template Library offers to C++ programmers.
|
|
Therefore, anyone familiar with the STL will have no trouble using and
|
|
understanding the machinery of ObjectiveLib.
|
|
|
|
An important component used by all services of ObjectiveLib is the
|
|
memory allocator. All containers allocate memory using an associated
|
|
memory allocator. This includes memory used to store elements in the
|
|
container, iterators, and any temporary buffers that may be needed.
|
|
Algorithms also need to allocate memory, so there is an allocator
|
|
associated with the OLAlgorithm class. Though the algorithm allocator
|
|
appears static, in fact an allocator is associated with each thread.
|
|
Therefore, memory allocation when using algorithms is thread-safe.
|