Skip to content
Permalink
Browse files

Document #46

  • Loading branch information
samchon committed Dec 28, 2019
1 parent 619b8d9 commit 033d436b47d8ea3bf6d8b3e02313bcfc5ca27e0f
@@ -24,32 +24,32 @@ Below components are list of provided objects in the **TSTL**. If you want to kn
## Features
### Containers
- **Linear Containers**
- [Vector `vector`](http://samchon.github.io/tstl/api/classes/std.vector.html)
- [Deque `deque`](http://samchon.github.io/tstl/api/classes/std.deque.html)
- [List `list`](http://samchon.github.io/tstl/api/classes/std.list.html)
- [ForwardList `forward_list`](http://samchon.github.io/tstl/api/classes/std.forwardlist.html)
- [VectorBoolean `vector_bool`](http://samchon.github.io/tstl/api/classes/std.vectorboolean.html)
- [Vector](http://tstl.dev/api/classes/std.vector.html)
- [Deque](http://tstl.dev/api/classes/std.deque.html)
- [List](http://tstl.dev/api/classes/std.list.html)
- [ForwardList](http://tstl.dev/api/classes/std.forwardlist.html)
- [VectorBoolean](http://tstl.dev/api/classes/std.vectorboolean.html)
- **Associative Containers**
- *Tree-structured Containers*
- [TreeSet `set`](http://samchon.github.io/tstl/api/classes/std.treeset.html)
- [TreeMultiSet `multiset`](http://samchon.github.io/tstl/api/classes/std.treemultiset.html)
- [TreeMap `map`](http://samchon.github.io/tstl/api/classes/std.treemap.html)
- [TreeMultiMap `multimap`](http://samchon.github.io/tstl/api/classes/std.treemultimap.html)
- [TreeSet](http://tstl.dev/api/classes/std.treeset.html)
- [TreeMultiSet](http://tstl.dev/api/classes/std.treemultiset.html)
- [TreeMap](http://tstl.dev/api/classes/std.treemap.html)
- [TreeMultiMap](http://tstl.dev/api/classes/std.treemultimap.html)
- *Hash-buckets based Container*
- [HashSet `unordered_set`](http://samchon.github.io/tstl/api/classes/std.hashset.html)
- [HashMultiSet `unordered_multiset`](http://samchon.github.io/tstl/api/classes/std.hashmultiset.html)
- [HashMap `unordered_map`](http://samchon.github.io/tstl/api/classes/std.hashmap.html)
- [HashMultiMap `unordered_multimap`](http://samchon.github.io/tstl/api/classes/std.hashmultimap.html)
- [HashSet](http://tstl.dev/api/classes/std.hashset.html)
- [HashMultiSet](http://tstl.dev/api/classes/std.hashmultiset.html)
- [HashMap](http://tstl.dev/api/classes/std.hashmap.html)
- [HashMultiMap](http://tstl.dev/api/classes/std.hashmultimap.html)
- **Adaptor Containers**
- *Linear Adaptors*
- [Queue `queue`](http://samchon.github.io/tstl/api/classes/std.queue.html)
- [Stack `stack`](http://samchon.github.io/tstl/api/classes/std.stack.html)
- [PriorityQueue `priority_queue`](http://samchon.github.io/tstl/api/classes/std.priorityqueue.html)
- [Queue](http://tstl.dev/api/classes/std.queue.html)
- [Stack](http://tstl.dev/api/classes/std.stack.html)
- [PriorityQueue](http://tstl.dev/api/classes/std.priorityqueue.html)
- Associative Adaptors
- (experimental) [FlatSet `flat_set`](http://samchon.github.io/tstl/api/classes/std_experimental.flatset.html)
- (experimental) [FlatMultiSet `flat_multiset`](http://samchon.github.io/tstl/api/classes/std_experimental.flatmultiset.html)
- (experimental) [FlatMap `flat_map`](http://samchon.github.io/tstl/api/classes/std_experimental.flatmap.html)
- (experimental) [FlatMultiMap `flat_multimap`](http://samchon.github.io/tstl/api/classes/std_experimental.flatmultimap.html)
- (experimental) [FlatSet](http://tstl.dev/api/classes/std_experimental.flatset.html)
- (experimental) [FlatMultiSet](http://tstl.dev/api/classes/std_experimental.flatmultiset.html)
- (experimental) [FlatMap](http://tstl.dev/api/classes/std_experimental.flatmap.html)
- (experimental) [FlatMultiMap](http://tstl.dev/api/classes/std_experimental.flatmultimap.html)

### Algorithms
- [`<algorithm>`](http://www.cplusplus.com/reference/algorithm/)
@@ -64,24 +64,25 @@ Below components are list of provided objects in the **TSTL**. If you want to kn

### Functors
- [`<exception>`](http://www.cplusplus.com/reference/exception/)
- [Exception `exception`](http://samchon.github.io/tstl/api/classes/std.exception.html)
- [LogicError `logic_error`](http://samchon.github.io/tstl/api/classes/std.logicerror.html)
- [RuntimeError `runtime_error`](http://samchon.github.io/tstl/api/classes/std.runtimeerror.html)
- [Exception](http://tstl.dev/api/classes/std.exception.html)
- [LogicError](http://tstl.dev/api/classes/std.logicerror.html)
- [RuntimeError](http://tstl.dev/api/classes/std.runtimeerror.html)
- [`<functional>`](http://www.cplusplus.com/reference/functional/)
- [IComparable](http://samchon.github.io/tstl/api/interfaces/std.icomparable.html)
- [IComparable](http://tstl.dev/api/interfaces/std.icomparable.html)
- [IPointer](https://tstl.dev/api/modules/std.ipointer.html)
- [`<utility>`](http://www.cplusplus.com/reference/utility/)
- [Pair `pair`](http://samchon.github.io/tstl/api/classes/std.pair.html)
- [Pair](http://tstl.dev/api/classes/std.pair.html)
- [`<numeric>`](http://en.cppreference.com/w/cpp/numeric)
- [IComputable](https://github.com/samchon/tstl/blob/master/src/numeric/IComputable.ts)
- [operations](https://github.com/samchon/tstl/blob/master/src/numeric/operations.ts)
- [special math](http://en.cppreference.com/w/cpp/numeric/special_math)
- [`<thread>`](https://github.com/samchon/tstl/blob/master/src/thread.ts)
- [ConditionVariable `condition_variable`](http://samchon.github.io/tstl/api/classes/std.conditionvariable.html)
- [Mutex `mutex`](http://samchon.github.io/tstl/api/classes/std.mutex.html) & [TimedMutex `timed_mutex`](http://samchon.github.io/tstl/api/classes/std.timedmutex.html)
- [SharedMutex `shared_mutex`](http://samchon.github.io/tstl/api/classes/std.sharedmutex.html) & [SharedTimeMutex `shared_timed_mutex`](http://samchon.github.io/tstl/api/classes/std.sharedtimedmutex.html)
- (experimental) [Semaphore `counting_semaphore`](http://samchon.github.io/tstl/api/classes/std_experimental.semaphore.html)
- (experimental) [Latch `latch`](http://samchon.github.io/tstl/api/classes/std_experimental.latch.html)
- (experimental) [Barrier `barrier`](http://samchon.github.io/tstl/api/classes/std_experimental.barrier.html)
- [ConditionVariable](http://tstl.dev/api/classes/std.conditionvariable.html)
- [Mutex](http://tstl.dev/api/classes/std.mutex.html) & [TimedMutex](http://tstl.dev/api/classes/std.timedmutex.html)
- [SharedMutex](http://tstl.dev/api/classes/std.sharedmutex.html) & [SharedTimeMutex](http://tstl.dev/api/classes/std.sharedtimedmutex.html)
- [Semaphore](http://tstl.dev/api/classes/std.semaphore.html)
- [Latch](http://tstl.dev/api/classes/std.latch.html)
- [Barrier](http://tstl.dev/api/classes/std.barrier.html)



@@ -129,7 +130,7 @@ main();
- [NPM Repository](https://www.npmjs.com/package/tstl)
- **Documents**
- [**Guide Documents**](https://github.com/samchon/tstl/wiki)
- [API Documents](http://samchon.github.io/tstl/api)
- [API Documents](http://tstl.dev/api)
- [Release Notes](https://github.com/samchon/tstl/releases)
- **Extensions**
- [ECol](https://github.com/samchon/ecol) - Collections dispatching events
@@ -6,11 +6,11 @@
"email": "samchon@samchon.org",
"url": "http://samchon.org"
},
"version": "2.4.0-dev.20191227",
"version": "2.4.0-dev.20191228",
"main": "./index.js",
"typings": "./index.d.ts",
"scripts": {
"api": "typedoc src --plugin typedoc-plugin-external-module-name --exclude \"**/+(test|benchmark)/**\" --excludePrivate --excludeProtected --excludeNotExported --out ",
"api": "typedoc src --ignoreCompilerErrors --plugin typedoc-plugin-external-module-name --exclude \"**/+(test|benchmark)/**\" --excludePrivate --excludeProtected --excludeNotExported --out ",
"benchmark": "node benchmark",
"build": "npm run module && npm run compile && npm run test",
"clean": "node build/clean",
@@ -35,52 +35,23 @@
},
"license": "MIT",
"keywords": [
"tstl",
"typescript stl",
"typescript standard template library",
"container",
"iterator",
"algorithm",
"functor",
"exception",
"functional",
"utility",
"thread",
"numeric",
"special_math",
"vector",
"deque",
"list",
"forward_list",
"stack",
"queue",
"priority_queue",
"set",
"multiset",
"unordered_set",
"unordered_multiset",
"map",
"multimap",
"unordered_map",
"unordered_multimap",
"TreeSet",
"TreeMultiSet",
"HashSet",
"HashMultiSet",
"TreeMap",
"TreeMultiMap",
"HashMap",
"HashMultiMap",
"mutex",
"shared_mutex",
"timed_mutex",
"shared_timed_mutex",
"unique_lock",
"shared_lock",
"semaphore",
"timed_semaphore",
"latch",
"barrier",
"flex_barrier"
"tstl",
"typecript", "c++", "cpp",
"stl", "standard template library",

"algorithm", "container", "exception", "functional",
"iterator", "numeric", "ranges", "thread", "utility",
"base", "experimental", "internal",

"Vector", "Deque", "List", "VectorBoolean", "ForwardList",
"Stack", "Queue", "PriorityQueue",
"FlatMap", "FlatMultiMap", "FlatMultiSet", "FlatSet",
"HashMap", "HashMultiMap", "HashMultiSet", "HashSet",
"TreeMap", "TreeMultiMap", "TreeMultiSet", "TreeSet",

"ConditionVariable", "Semaphore",
"Latch", "Barrier", "FlexBarrier",
"Mutex", "TimedMutex", "SharedMutex", "SharedTimedMutex",
"SharedLock", "UniqueLock"
]
}
@@ -13,6 +13,15 @@ import { Comparator } from "../../internal/functional/Comparator";
/* =========================================================
BINARY SEARCH
========================================================= */
/**
* Get iterator to lower bound.
*
* @param range An iterable ranged container.
* @param val Value to search for.
* @param comp A binary function predicates *x* element would be placed before *y*. When returns `true`, then *x* precedes *y*. Default is {@link less}.
*
* @return Iterator to the first element equal or after the val.
*/
export function lower_bound<Range extends Array<any> | IForwardContainer<any>>
(
range: Range,
@@ -23,6 +32,15 @@ export function lower_bound<Range extends Array<any> | IForwardContainer<any>>
return base.lower_bound(begin(range), end(range), val, comp);
}

/**
* Get iterator to upper bound.
*
* @param range An iterable ranged container.
* @param val Value to search for.
* @param comp A binary function predicates *x* element would be placed before *y*. When returns `true`, then *x* precedes *y*. Default is {@link less}.
*
* @return Iterator to the first element after the key.
*/
export function upper_bound<Range extends Array<any> | IForwardContainer<any>>
(
range: Range,
@@ -33,6 +51,15 @@ export function upper_bound<Range extends Array<any> | IForwardContainer<any>>
return base.upper_bound(begin(range), end(range), val, comp);
}

/**
* Get range of equal elements.
*
* @param range An iterable ranged container.
* @param val Value to search for.
* @param comp A binary function predicates *x* element would be placed before *y*. When returns `true`, then *x* precedes *y*. Default is {@link less}.
*
* @return Pair of {@link lower_bound} and {@link upper_bound}.
*/
export function equal_range<Range extends Array<any> | IForwardContainer<any>>
(
range: Range,
@@ -43,6 +70,15 @@ export function equal_range<Range extends Array<any> | IForwardContainer<any>>
return base.equal_range(begin(range), end(range), val, comp);
}

/**
* Test whether a value exists in sorted range.
*
* @param range An iterable ranged container.
* @param val Value to search for.
* @param comp A binary function predicates *x* element would be placed before *y*. When returns `true`, then *x* precedes *y*. Default is {@link less}.
*
* @return Whether the value exists or not.
*/
export function binary_search<Range extends Array<any> | IForwardContainer<any>>
(
range: Range,
@@ -11,18 +11,36 @@ import { less } from "../../functional/comparators";
/* ---------------------------------------------------------
PUSH & POP
--------------------------------------------------------- */
/**
* Make a heap.
*
* @param range An iterable ranged container.
* @param comp A binary function predicates *x* element would be placed before *y*. When returns `true`, then *x* precedes *y*. Default is {@link less}.
*/
export function make_heap<Range extends Array<any> | IRandomAccessContainer<any>>
(range: Range, comp: Comparator<IRandomAccessContainer.ValueType<Range>> = less): void
{
return base.make_heap(begin(range), end(range), comp);
}

/**
* Push an element into heap.
*
* @param range An iterable ranged container.
* @param comp A binary function predicates *x* element would be placed before *y*. When returns `true`, then *x* precedes *y*. Default is {@link less}.
*/
export function push_heap<Range extends Array<any> | IRandomAccessContainer<any>>
(range: Range, comp: Comparator<IRandomAccessContainer.ValueType<Range>> = less): void
{
return base.push_heap(begin(range), end(range), comp);
}

/**
* Pop an element from heap.
*
* @param range An iterable ranged container.
* @param comp A binary function predicates *x* element would be placed before *y*. When returns `true`, then *x* precedes *y*. Default is {@link less}.
*/
export function pop_heap<Range extends Array<any> | IRandomAccessContainer<any>>
(range: Range, comp: Comparator<IRandomAccessContainer.ValueType<Range>> = less): void
{
@@ -32,18 +50,40 @@ export function pop_heap<Range extends Array<any> | IRandomAccessContainer<any>>
/* ---------------------------------------------------------
SORT
--------------------------------------------------------- */
/**
* Test whether a range is heap.
*
* @param range An iterable ranged container.
* @param comp A binary function predicates *x* element would be placed before *y*. When returns `true`, then *x* precedes *y*. Default is {@link less}.
*
* @return Whether the range is heap.
*/
export function is_heap<Range extends Array<any> | IRandomAccessContainer<any>>
(range: Range, comp: Comparator<IRandomAccessContainer.ValueType<Range>> = less): boolean
{
return base.is_heap(begin(range), end(range), comp);
}

/**
* Find the first element not in heap order.
*
* @param range An iterable ranged container.
* @param comp A binary function predicates *x* element would be placed before *y*. When returns `true`, then *x* precedes *y*. Default is {@link less}.
*
* @return Iterator to the first element not in heap order.
*/
export function is_heap_until<Range extends Array<any> | IRandomAccessContainer<any>>
(range: Range, comp: Comparator<IRandomAccessContainer.ValueType<Range>> = less): IRandomAccessContainer.IteratorType<Range>
{
return base.is_heap_until(<any>begin(range), <any>end(range), <any>comp);
}

/**
* Sort elements of a heap.
*
* @param range An iterable ranged container.
* @param comp A binary function predicates *x* element would be placed before *y*. When returns `true`, then *x* precedes *y*. Default is {@link less}.
*/
export function sort_heap<Range extends Array<any> | IRandomAccessContainer<any>>
(range: Range, comp: Comparator<IRandomAccessContainer.ValueType<Range>> = less): void
{

0 comments on commit 033d436

Please sign in to comment.
You can’t perform that action at this time.