JSON array. An array is an ordered collection of values. More...
#include </home/runner/work/metall/metall/include/metall/json/array.hpp>
Public Types | |
| using | value_type = value< Alloc > |
| using | allocator_type = Alloc |
| using | iterator = typename array_type::iterator |
| using | const_iterator = typename array_type::const_iterator |
| using | reference = value_type & |
| using | const_reference = const value_type & |
Public Member Functions | |
| array ()=default | |
| Constructor. | |
| array (const allocator_type &alloc) | |
| Constructor. | |
| array (const array &)=default | |
| Copy constructor. | |
| array (const array &other, const allocator_type &alloc) | |
| Allocator-extended copy constructor. | |
| array (array &&) noexcept=default | |
| Move constructor. | |
| array (array &&other, const allocator_type &alloc) noexcept | |
| Allocator-extended move constructor. | |
| array & | operator= (const array &)=default |
| Copy assignment operator. | |
| array & | operator= (array &&) noexcept=default |
| Move assignment operator. | |
| void | swap (array &other) noexcept |
| Swap contents. | |
| std::size_t | size () const noexcept |
| Returns the number of values. | |
| std::size_t | capacity () const noexcept |
| Returns the number of values that can be held in currently allocated storage. | |
| void | resize (const std::size_t size) |
| Change the number of elements stored. | |
| void | clear () |
| Clear the contents. | |
| reference | operator[] (const std::size_t index) |
| Access an element. | |
| const_reference | operator[] (const std::size_t index) const |
| Access an element. | |
| iterator | begin () |
| Returns an iterator that is at the beginning of the array. | |
| const_iterator | begin () const |
| Returns an iterator that is at the beginning of the array. | |
| iterator | end () |
| Returns an iterator that is at the end of the array. | |
| const_iterator | end () const |
| Returns an iterator that is at the end of the array. | |
| iterator | erase (iterator position) |
| Erases the element at 'position'. | |
| iterator | erase (const_iterator position) |
| Erases the element at 'position'. | |
| void | push_back (const value_type &value) |
| Add an element to the end of the array. Expand (resize) the array if capacity() < size() + 1. | |
| void | push_back (value_type &&value) |
| Add an element to the end of the array. Expand (resize) the array if capacity() < size() + 1. | |
| allocator_type | get_allocator () const noexcept |
| Return an allocator object. | |
Friends | |
| bool | operator== (const array &lhs, const array &rhs) noexcept |
Return true if two arrays are equal. Arrays are equal when their sizes are the same, and they are element-for-element equal in order. | |
| bool | operator!= (const array &lhs, const array &rhs) noexcept |
Return true if two arrays are not equal. Arrays are equal when their sizes are the same, and they are element-for-element equal in order. | |
JSON array. An array is an ordered collection of values.
| using metall::json::array< Alloc >::value_type = value<Alloc> |
| using metall::json::array< Alloc >::allocator_type = Alloc |
| using metall::json::array< Alloc >::iterator = typename array_type::iterator |
| using metall::json::array< Alloc >::const_iterator = typename array_type::const_iterator |
| using metall::json::array< Alloc >::reference = value_type & |
| using metall::json::array< Alloc >::const_reference = const value_type & |
|
default |
Constructor.
|
inlineexplicit |
Constructor.
| alloc | An allocator object. |
|
default |
Copy constructor.
|
inline |
Allocator-extended copy constructor.
|
defaultnoexcept |
Move constructor.
|
inlinenoexcept |
Allocator-extended move constructor.
|
default |
Copy assignment operator.
|
defaultnoexcept |
Move assignment operator.
|
inlinenoexcept |
Swap contents.
|
inlinenoexcept |
Returns the number of values.
|
inlinenoexcept |
Returns the number of values that can be held in currently allocated storage.
|
inline |
Change the number of elements stored.
| size | A new size. |
|
inline |
Clear the contents.
|
inline |
Access an element.
| index | The index of the element to access. |
|
inline |
Access an element.
| index | The index of the element to access. |
|
inline |
Returns an iterator that is at the beginning of the array.
|
inline |
Returns an iterator that is at the beginning of the array.
|
inline |
Returns an iterator that is at the end of the array.
|
inline |
Returns an iterator that is at the end of the array.
|
inline |
Erases the element at 'position'.
| position | The position of the element to erase. |
|
inline |
Erases the element at 'position'.
| position | The position of the element to erase. |
|
inline |
Add an element to the end of the array. Expand (resize) the array if capacity() < size() + 1.
| value | Value to add. |
|
inline |
Add an element to the end of the array. Expand (resize) the array if capacity() < size() + 1.
| value | Value to add. |
|
inlinenoexcept |
Return an allocator object.
|
friend |
Return true if two arrays are equal. Arrays are equal when their sizes are the same, and they are element-for-element equal in order.
| lhs | An array to compare. |
| rhs | An array to compare. |
|
friend |
Return true if two arrays are not equal. Arrays are equal when their sizes are the same, and they are element-for-element equal in order.
| lhs | An array to compare. |
| rhs | An array to compare. |