Metall  v0.29
A persistent memory allocator for data-centric analytics
metall::json::array< Alloc > Class Template Reference

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...
 
arrayoperator= (const array &)=default
 Copy assignment operator. More...
 
arrayoperator= (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...
 

Detailed Description

template<typename Alloc = std::allocator<std::byte>>
class metall::json::array< Alloc >

JSON array. An array is an ordered collection of values.

Member Typedef Documentation

◆ value_type

template<typename Alloc = std::allocator<std::byte>>
using metall::json::array< Alloc >::value_type = value<Alloc>

◆ allocator_type

template<typename Alloc = std::allocator<std::byte>>
using metall::json::array< Alloc >::allocator_type = Alloc

◆ iterator

template<typename Alloc = std::allocator<std::byte>>
using metall::json::array< Alloc >::iterator = typename array_type::iterator

◆ const_iterator

template<typename Alloc = std::allocator<std::byte>>
using metall::json::array< Alloc >::const_iterator = typename array_type::const_iterator

◆ reference

template<typename Alloc = std::allocator<std::byte>>
using metall::json::array< Alloc >::reference = value_type &

◆ const_reference

template<typename Alloc = std::allocator<std::byte>>
using metall::json::array< Alloc >::const_reference = const value_type &

Constructor & Destructor Documentation

◆ array() [1/6]

template<typename Alloc = std::allocator<std::byte>>
metall::json::array< Alloc >::array ( )
default

Constructor.

◆ array() [2/6]

template<typename Alloc = std::allocator<std::byte>>
metall::json::array< Alloc >::array ( const allocator_type alloc)
inlineexplicit

Constructor.

Parameters
allocAn allocator object.

◆ array() [3/6]

template<typename Alloc = std::allocator<std::byte>>
metall::json::array< Alloc >::array ( const array< Alloc > &  )
default

Copy constructor.

◆ array() [4/6]

template<typename Alloc = std::allocator<std::byte>>
metall::json::array< Alloc >::array ( const array< Alloc > &  other,
const allocator_type alloc 
)
inline

Allocator-extended copy constructor.

◆ array() [5/6]

template<typename Alloc = std::allocator<std::byte>>
metall::json::array< Alloc >::array ( array< Alloc > &&  )
defaultnoexcept

Move constructor.

◆ array() [6/6]

template<typename Alloc = std::allocator<std::byte>>
metall::json::array< Alloc >::array ( array< Alloc > &&  other,
const allocator_type alloc 
)
inlinenoexcept

Allocator-extended move constructor.

Member Function Documentation

◆ operator=() [1/2]

template<typename Alloc = std::allocator<std::byte>>
array& metall::json::array< Alloc >::operator= ( const array< Alloc > &  )
default

Copy assignment operator.

◆ operator=() [2/2]

template<typename Alloc = std::allocator<std::byte>>
array& metall::json::array< Alloc >::operator= ( array< Alloc > &&  )
defaultnoexcept

Move assignment operator.

◆ swap()

template<typename Alloc = std::allocator<std::byte>>
void metall::json::array< Alloc >::swap ( array< Alloc > &  other)
inlinenoexcept

Swap contents.

◆ size()

template<typename Alloc = std::allocator<std::byte>>
std::size_t metall::json::array< Alloc >::size ( ) const
inlinenoexcept

Returns the number of values.

Returns
The number of vertices.

◆ capacity()

template<typename Alloc = std::allocator<std::byte>>
std::size_t metall::json::array< Alloc >::capacity ( ) const
inlinenoexcept

Returns the number of values that can be held in currently allocated storage.

Returns
The number of values that can be held in currently allocated storage.

◆ resize()

template<typename Alloc = std::allocator<std::byte>>
void metall::json::array< Alloc >::resize ( const std::size_t  size)
inline

Change the number of elements stored.

Parameters
sizeA new size.

◆ clear()

template<typename Alloc = std::allocator<std::byte>>
void metall::json::array< Alloc >::clear ( )
inline

Clear the contents.

◆ operator[]() [1/2]

template<typename Alloc = std::allocator<std::byte>>
reference metall::json::array< Alloc >::operator[] ( const std::size_t  index)
inline

Access an element.

Parameters
indexThe index of the element to access.
Returns
A reference to the element at 'index'.

◆ operator[]() [2/2]

template<typename Alloc = std::allocator<std::byte>>
const_reference metall::json::array< Alloc >::operator[] ( const std::size_t  index) const
inline

Access an element.

Parameters
indexThe index of the element to access.
Returns
A const reference to the element at 'index'.

◆ begin() [1/2]

template<typename Alloc = std::allocator<std::byte>>
iterator metall::json::array< Alloc >::begin ( )
inline

Returns an iterator that is at the beginning of the array.

Returns
An iterator that is at the beginning of the array.

◆ begin() [2/2]

template<typename Alloc = std::allocator<std::byte>>
const_iterator metall::json::array< Alloc >::begin ( ) const
inline

Returns an iterator that is at the beginning of the array.

Returns
A const iterator that is at the beginning of the array.

◆ end() [1/2]

template<typename Alloc = std::allocator<std::byte>>
iterator metall::json::array< Alloc >::end ( )
inline

Returns an iterator that is at the end of the array.

Returns
An iterator that is at the end of the array.

◆ end() [2/2]

template<typename Alloc = std::allocator<std::byte>>
const_iterator metall::json::array< Alloc >::end ( ) const
inline

Returns an iterator that is at the end of the array.

Returns
A const iterator that is at the end of the array.

◆ erase() [1/2]

template<typename Alloc = std::allocator<std::byte>>
iterator metall::json::array< Alloc >::erase ( iterator  position)
inline

Erases the element at 'position'.

Parameters
positionThe position of the element to erase.
Returns
Iterator following the removed element. If 'position' refers to the last element, then the end() iterator is returned.

◆ erase() [2/2]

template<typename Alloc = std::allocator<std::byte>>
iterator metall::json::array< Alloc >::erase ( const_iterator  position)
inline

Erases the element at 'position'.

Parameters
positionThe position of the element to erase.
Returns
Iterator following the removed element. If 'position' refers to the last element, then the end() iterator is returned.

◆ push_back() [1/2]

template<typename Alloc = std::allocator<std::byte>>
void metall::json::array< Alloc >::push_back ( const value_type value)
inline

Add an element to the end of the array. Expand (resize) the array if capacity() < size() + 1.

Parameters
valueValue to add.

◆ push_back() [2/2]

template<typename Alloc = std::allocator<std::byte>>
void metall::json::array< Alloc >::push_back ( value_type &&  value)
inline

Add an element to the end of the array. Expand (resize) the array if capacity() < size() + 1.

Parameters
valueValue to add.

◆ get_allocator()

template<typename Alloc = std::allocator<std::byte>>
allocator_type metall::json::array< Alloc >::get_allocator ( ) const
inlinenoexcept

Return an allocator object.

Friends And Related Function Documentation

◆ operator==

template<typename Alloc = std::allocator<std::byte>>
bool operator== ( const array< Alloc > &  lhs,
const array< Alloc > &  rhs 
)
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.

Parameters
lhsAn array to compare.
rhsAn array to compare.
Returns
True if two arrays are equal. Otherwise, false.

◆ operator!=

template<typename Alloc = std::allocator<std::byte>>
bool operator!= ( const array< Alloc > &  lhs,
const array< Alloc > &  rhs 
)
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.

Parameters
lhsAn array to compare.
rhsAn array to compare.
Returns
True if two arrays are not equal. Otherwise, false.

The documentation for this class was generated from the following file: