#include <array.hpp>
List of all members.
Public Member Functions |
| | Array (size_t length=0) |
| template<class InputIterator > |
| | Array (InputIterator begin, InputIterator end) |
| T & | operator[] (size_t i) |
| ssize_t | indexOf (const T &item) const |
| void | push (const T &value) |
| void | unshift (const T &value) |
| T | pop () |
| T | shift () |
| void | reverse () |
| Array< T > | slice (ssize_t begin, ssize_t end=0) const |
| void | sort (std::tr1::function< bool(const T &, const T &)> comparator=std::less< T >()) |
| void | forEach (std::tr1::function< void(T &)> callback) |
| template<typename R > |
| Array< R > | map (std::tr1::function< R(const T &)> callback) const |
| bool | every (std::tr1::function< bool(const T &)> condition) const |
| bool | some (std::tr1::function< bool(const T &)> condition) const |
| Array< T > | filter (std::tr1::function< bool(const T &)> test) const |
| T | reduce (std::tr1::function< T(const T &, const T &)> callback=std::plus< T >()) const |
| T | reduce (std::tr1::function< T(const T &, const T &)> callback, const T &initialValue, size_t startFrom=0) const |
| size_t | length () const |
Detailed Description
template<typename T>
class js4cpp::Array< T >
JS-style array.
- See also:
- https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array
- Template Parameters:
-
Constructor & Destructor Documentation
template<typename T>
template<class InputIterator >
Create new array from iterators range.
- Template Parameters:
-
- Parameters:
-
| begin | Range's begin. |
| end | Range's end. |
Member Function Documentation
template<typename T>
| bool js4cpp::Array< T >::every |
( |
std::tr1::function< bool(const T &)> |
condition | ) |
const |
|
inline |
template<typename T>
| void js4cpp::Array< T >::forEach |
( |
std::tr1::function< void(T &)> |
callback | ) |
|
|
inline |
template<typename T>
template<typename R >
Get element under given index.
- Parameters:
-
- Returns:
- Element.
template<typename T>
| T js4cpp::Array< T >::reduce |
( |
std::tr1::function< T(const T &, const T &)> |
callback = std::plus<T>() | ) |
const |
|
inline |
template<typename T>
| T js4cpp::Array< T >::reduce |
( |
std::tr1::function< T(const T &, const T &)> |
callback, |
|
|
const T & |
initialValue, |
|
|
size_t |
startFrom = 0 |
|
) |
| const |
|
inline |
template<typename T>
| bool js4cpp::Array< T >::some |
( |
std::tr1::function< bool(const T &)> |
condition | ) |
const |
|
inline |
template<typename T>
| void js4cpp::Array< T >::sort |
( |
std::tr1::function< bool(const T &, const T &)> |
comparator = std::less<T>() | ) |
|
|
inline |
The documentation for this class was generated from the following file: