![]() |
FIMS
v0.8.1
|
#include <fims_vector.hpp>
Public Types | |
| typedef std::vector< Type >::value_type | value_type |
| typedef std::vector< Type >::allocator_type | allocator_type |
| typedef std::vector< Type >::size_type | size_type |
| typedef std::vector< Type >::difference_type | difference_type |
| typedef std::vector< Type >::reference | reference |
| typedef std::vector< Type >::const_reference | const_reference |
| typedef std::vector< Type >::pointer | pointer |
| typedef std::vector< Type >::const_pointer | const_pointer |
| typedef std::vector< Type >::iterator | iterator |
| typedef std::vector< Type >::const_iterator | const_iterator |
| typedef std::vector< Type >::reverse_iterator | reverse_iterator |
| typedef std::vector< Type >::const_reverse_iterator | const_reverse_iterator |
Public Member Functions | |
| Vector () | |
| Vector (size_t size, const Type &value=Type()) | |
| Constructs a Vector of length "size" and sets the elements with the value from input "value". | |
| Vector (const Vector< Type > &other) | |
| Copy constructor. | |
| Vector & | operator= (const Vector &other) |
| Assignment operator for fims::Vector. | |
| Vector (const std::vector< Type > &other) | |
| Initialization constructor from std::vector<Type> type. | |
| Vector (std::initializer_list< Type > init) | |
| Initialization constructor from std::initializer_list<Type> type. | |
| Type & | operator[] (size_t pos) |
| Returns a reference to the element at specified location pos. No bounds checking is performed. | |
| const Type & | operator[] (size_t n) const |
| Returns a constant reference to the element at specified location pos. No bounds checking is performed. | |
| Type & | at (size_t n) |
| Returns a reference to the element at specified location pos. Bounds checking is performed. | |
| const Type & | at (size_t n) const |
| Returns a constant reference to the element at specified location pos. Bounds checking is performed. | |
| Type & | get_force_scalar (size_t pos) |
| If this vector is size 1 and pos is greater than zero, the first index is returned. If this vector has size greater than 1 and pos is greater than size, a invalid_argument exception is thrown. Otherwise, the value at index pos is returned. | |
| reference | front () |
| Returns a reference to the first element in the container. | |
| const_reference | front () const |
| Returns a constant reference to the first element in the container. | |
| reference | back () |
| Returns a reference to the last element in the container. | |
| const_reference | back () const |
| Returns a constant reference to the last element in the container. | |
| pointer | data () |
| Returns a pointer to the underlying data array. | |
| const_pointer | data () const |
| Returns a constant pointer to the underlying data array. | |
| iterator | begin () |
| Returns an iterator to the first element of the vector. | |
| iterator | end () |
| Returns an iterator to the element following the last element of the vector. | |
| reverse_iterator | rbegin () |
| Returns a reverse iterator to the first element of the reversed vector. It corresponds to the last element of the non-reversed vector. | |
| reverse_iterator | rend () |
| Returns a reverse iterator to the element following the last element of the reversed vector. It corresponds to the element preceding the first element of the non-reversed vector. | |
| const_reverse_iterator | rbegin () const |
| Returns a constant reverse iterator to the first element of the reversed vector. It corresponds to the last element of the non-reversed vector. | |
| const_reverse_iterator | rend () const |
| Returns a constant reverse iterator to the element following the last element of the reversed vector. It corresponds to the element preceding the first element of the non-reversed vector. | |
| bool | empty () |
| Checks whether the container is empty. | |
| size_type | size () const |
| Returns the number of elements. | |
| size_type | max_size () const |
| Returns the maximum possible number of elements. | |
| void | reserve (size_type cap) |
| Reserves storage. | |
| size_type | capacity () |
| Returns the number of elements that can be held in currently allocated storage. | |
| void | shrink_to_fit () |
| Reduces memory usage by freeing unused memory. | |
| void | clear () |
| Clears the contents. | |
| iterator | insert (const_iterator pos, const Type &value) |
| Inserts value before pos. | |
| iterator | insert (const_iterator pos, size_type count, const Type &value) |
| Inserts count copies of the value before pos. | |
| template<class InputIt > | |
| iterator | insert (const_iterator pos, InputIt first, InputIt last) |
| Inserts elements from range [first, last) before pos. | |
| iterator | insert (const_iterator pos, std::initializer_list< Type > ilist) |
| Inserts elements from initializer list ilist before pos. | |
| template<class... Args> | |
| iterator | emplace (const_iterator pos, Args &&...args) |
| Constructs element in-place. | |
| iterator | erase (iterator pos) |
| Removes the element at pos. | |
| iterator | erase (iterator first, iterator last) |
| Removes the elements in the range [first, last). | |
| void | push_back (const Type &&value) |
| Adds an element to the end. | |
| template<class... Args> | |
| void | emplace_back (Args &&...args) |
| Constructs an element in-place at the end. | |
| void | pop_back () |
| Removes the last element. | |
| void | resize (size_t s) |
| Changes the number of elements stored. | |
| void | swap (Vector &other) |
| Swaps the contents. | |
| operator std::vector< Type > () | |
| Converts fims::Vector<Type> to std::vector<Type> | |
| std::vector< Type > | to_std () const |
| Convert fims::Vector to std::vector. | |
| std::vector< Type > | to_tmb () const |
| Convert fims::Vector to TMB vector type. | |
| std::string | get_tag () const |
| Gets the tag for the vector. A tag can represent anything and is not used internally by FIMS. | |
| void | set_tag (const std::string &tag) |
| Sets the tag for the vector. A tag can be set to any string value and is not used internally by FIMS. | |
Friends | |
| template<typename T > | |
| bool | operator== (const fims::Vector< T > &lhs, const fims::Vector< T > &rhs) |
| friend comparison operator. Allows the operator to see private members of fims::Vector<Type>. | |
Wrapper class for std::vector types. If this file is compiled with -DTMB_MODEL, conversion operators are defined for TMB vector types.
All std::vector functions are copied over from the std library. While some of these may not be called explicitly in FIMS, they may be required to run other std library functions.
| typedef std::vector<Type>::allocator_type fims::Vector< Type >::allocator_type |
Allocator for type Type>
| typedef std::vector<Type>::const_iterator fims::Vector< Type >::const_iterator |
Constant iterator>
| typedef std::vector<Type>::const_pointer fims::Vector< Type >::const_pointer |
Constant pointer type const Type*>
| typedef std::vector<Type>::const_reference fims::Vector< Type >::const_reference |
Constant reference type const &Type>
| typedef std::vector<Type>::const_reverse_iterator fims::Vector< Type >::const_reverse_iterator |
Constant reverse iterator>
| typedef std::vector<Type>::difference_type fims::Vector< Type >::difference_type |
Difference type>
Iterator>
Pointer type Type*>
Reference type &Type>
| typedef std::vector<Type>::reverse_iterator fims::Vector< Type >::reverse_iterator |
Reverse iterator>
Size type>
Member type Type>
|
inline |
Default constructor.
|
inline |
Returns a constant reference to the last element in the container.
␁*
If this vector is size 1 and pos is greater than zero, the first index is returned. If this vector has size greater than 1 and pos is greater than size, a invalid_argument exception is thrown. Otherwise, the value at index pos is returned.
| pos |
|
inline |
Gets the tag for the vector. A tag can represent anything and is not used internally by FIMS.
|
inline |
Converts fims::Vector<Type> to std::vector<Type>
Conversion operators
|
inline |
Assignment operator for fims::Vector.
Assigns the contents of another fims::Vector to this vector. Cleans up existing contents and performs a deep copy.
| other | The vector to assign from. |
|
inline |
Returns a reference to the element at specified location pos. No bounds checking is performed.
The following are std::vector functions copied over from the standard library. While some of these may not be called explicitly in FIMS, they may be required to run other std library functions.
|
inline |
Convert fims::Vector to std::vector.
Returns a standard vector containing the same elements as the fims::Vector.
|
inline |
Convert fims::Vector to TMB vector type.
Returns a TMB-compatible vector containing the same elements as the fims::Vector. Only available if compiled with TMB_MODEL.