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. More... | |
array (const allocator_type &alloc) | |
Constructor. More... | |
array (const array &)=default | |
Copy constructor. More... | |
array (const array &other, const allocator_type &alloc) | |
Allocator-extended copy constructor. More... | |
array (array &&) noexcept=default | |
Move constructor. More... | |
array (array &&other, const allocator_type &alloc) noexcept | |
Allocator-extended move constructor. More... | |
array & | operator= (const array &)=default |
Copy assignment operator. More... | |
array & | operator= (array &&) noexcept=default |
Move assignment operator. More... | |
void | swap (array &other) noexcept |
Swap contents. More... | |
std::size_t | size () const noexcept |
Returns the number of values. More... | |
std::size_t | capacity () const noexcept |
Returns the number of values that can be held in currently allocated storage. More... | |
void | resize (const std::size_t size) |
Change the number of elements stored. More... | |
void | clear () |
Clear the contents. More... | |
reference | operator[] (const std::size_t index) |
Access an element. More... | |
const_reference | operator[] (const std::size_t index) const |
Access an element. More... | |
iterator | begin () |
Returns an iterator that is at the beginning of the array. More... | |
const_iterator | begin () const |
Returns an iterator that is at the beginning of the array. More... | |
iterator | end () |
Returns an iterator that is at the end of the array. More... | |
const_iterator | end () const |
Returns an iterator that is at the end of the array. More... | |
iterator | erase (iterator position) |
Erases the element at 'position'. More... | |
iterator | erase (const_iterator position) |
Erases the element at 'position'. More... | |
void | push_back (const value_type &value) |
Add an element to the end of the array. Expand (resize) the array if capacity() < size() + 1. More... | |
void | push_back (value_type &&value) |
Add an element to the end of the array. Expand (resize) the array if capacity() < size() + 1. More... | |
allocator_type | get_allocator () const noexcept |
Return an allocator object. More... | |
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. More... | |
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. More... | |
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. |