Skip to content

TypeScript-STL v1.3.8

Compare
Choose a tag to compare
@samchon samchon released this 16 Jan 13:56
· 577 commits to master since this release

Breaking Changes

Vector no longer extends the Array

As the ES2015 has newly approached, It's hard to extend built-in classes with the transpilers like TypeScript. The only way to extend those built-in classes are using setPrototypeOf statement, which is not supported in IE10 and priors.

class Vector<T> extends Array<T>
{
    constructor(...args: any[])
    {
        super();
        Object.setPrototypeOf(this, Vector.prototype);
    }
}

In such reason, TypeScript-STL's Vector and Exception do not extend Array and Error, the built-in classes, more. As the same reason, base.IContainer is deprecated

//----
// ORDINARY VECTOR AND EXCEPTION, THEY HAD EXTENDED THE BUILT-IN CLASSES
//----
namespace std 
{
    export class Vector<T> extends Array<T> implements base.IContainer<T>;
    export class Exception extends Error;
}

//----
// HOWEVER, IT DOES NOT EXTEND BUILT-INS MORE
//----
namespace std 
{
    export class Vector<T> extends base.Container<T>;
    export class Exception;
}

Unnecessary comments are all deprecated

Unnecessary comments for API documentation are all deprecated. Private members and some methods start from the _ prefix, their symbols are all changed to the @hidden.

namespace std.base
{
    export abstract class MapContainer<Key, T>
    {
        /**
         * @hidden
         */
        private data_: _MapElementList<Key, T>;

        /**
         * @hidden
         */
        protected _Handle_insert(first: MapIterator<Key, T>, last: MapIterator<Key, T>): void;
    }
}

Error Fix

std.shuffle & std.random_shuffle

There was an error on std.shuffle and std.random_shuffle when the range iterators are pointing to the end.

let container: std.Vector<number> = new std.Vector<number>();
containers.push(1 , 2, 3, 4, 5);

// NO PROBLEM IN THAT CASE
std.sort(container.begin(), container.end().prev());

//--------
// WHEN END() OR REND() IS POINTED, THEN ERROR HAD OCCURED
//--------
// HOWEVER, THE ERROR DOES NOT OCCURE MORE
std.sort(container.begin(), container.end());
std.sort(container.rbegin(), container.rend());