![]() |
mutable
A Database System for Research and Fast Prototyping
|
Implements an array of dynamic but fixed size. More...
#include <ADT.hpp>
Public Types | |
using | value_type = T |
using | size_type = std::size_t |
using | iterator = value_type * |
using | const_iterator = const value_type * |
Public Member Functions | |
dyn_array () | |
Constructs an array of size 0. | |
dyn_array (std::size_t size) | |
Constructs an array of size size . | |
template<typename InputIt > | |
dyn_array (InputIt begin, InputIt end) | |
Constructs an array with the elements in range [begin, end) . | |
dyn_array (const dyn_array &other) | |
Copy-constructs an array. | |
dyn_array (dyn_array &&)=default | |
dyn_array & | operator= (dyn_array &&)=default |
size_type | size () const |
Returns the size of this array, i.e. | |
const value_type * | data () const |
Returns a pointer to the beginning of the array. | |
value_type * | data () |
Returns a pointer to the beginning of the array. | |
const value_type & | operator[] (std::size_t pos) const |
Returns a reference to the element at position pos . | |
value_type & | operator[] (std::size_t pos) |
Returns a reference to the element at position pos . | |
const value_type & | at (std::size_t pos) const |
Returns a reference to the element at position pos . | |
value_type & | at (std::size_t pos) |
Returns a reference to the element at position pos . | |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
const_iterator | cbegin () const |
const_iterator | cend () const |
bool | operator== (const dyn_array &other) const |
Returns true iff the contents of this and other are equal, that is, they have the same number of elements and each element in this compares equal with the element in other at the same position. | |
bool | operator!= (const dyn_array &other) const |
Returns false iff the contents of this and other are equal, that is, they have the same number of elements and each element in this compares equal with the element in other at the same position. | |
Private Attributes | |
std::unique_ptr< value_type[]> | arr_ |
std::size_t | size_ |
Implements an array of dynamic but fixed size.
using m::dyn_array< T >::const_iterator = const value_type* |
using m::dyn_array< T >::iterator = value_type* |
using m::dyn_array< T >::size_type = std::size_t |
using m::dyn_array< T >::value_type = T |
|
inline |
|
inlineexplicit |
|
inline |
Constructs an array with the elements in range [begin, end)
.
The size of the array will be std::distance(begin, end)
.
Definition at line 301 of file ADT.hpp.
References m::dyn_array< T >::begin(), m::dyn_array< T >::data(), and m::dyn_array< T >::end().
|
inlineexplicit |
Copy-constructs an array.
Definition at line 310 of file ADT.hpp.
References m::dyn_array< T >::data(), and m::dyn_array< T >::size().
|
default |
|
inline |
Returns a reference to the element at position pos
.
Throws m::out_of_range
if pos
is out of bounds.
Definition at line 348 of file ADT.hpp.
References m::dyn_array< T >::size().
|
inline |
Returns a reference to the element at position pos
.
Throws m::out_of_range
if pos
is out of bounds.
Definition at line 341 of file ADT.hpp.
References m::dyn_array< T >::size().
|
inline |
Definition at line 354 of file ADT.hpp.
References m::dyn_array< T >::data().
Referenced by m::dyn_array< T >::cbegin(), and m::dyn_array< T >::dyn_array().
|
inline |
Definition at line 356 of file ADT.hpp.
References m::dyn_array< T >::data().
|
inline |
Definition at line 358 of file ADT.hpp.
References m::dyn_array< T >::begin().
|
inline |
Definition at line 359 of file ADT.hpp.
References m::dyn_array< T >::end().
|
inline |
Returns a pointer to the beginning of the array.
Definition at line 326 of file ADT.hpp.
References m::dyn_array< T >::arr_.
|
inline |
Returns a pointer to the beginning of the array.
Definition at line 324 of file ADT.hpp.
References m::dyn_array< T >::arr_.
Referenced by m::dyn_array< T >::begin(), m::dyn_array< T >::dyn_array(), m::dyn_array< T >::end(), and m::dyn_array< T >::operator[]().
|
inline |
Definition at line 355 of file ADT.hpp.
References m::dyn_array< T >::data(), and m::dyn_array< T >::size().
Referenced by m::dyn_array< T >::cend(), and m::dyn_array< T >::dyn_array().
|
inline |
Definition at line 357 of file ADT.hpp.
References m::dyn_array< T >::data(), and m::dyn_array< T >::size().
|
inline |
Returns false
iff the contents of this
and other
are equal, that is, they have the same number of elements and each element in this
compares equal with the element in other
at the same position.
Definition at line 376 of file ADT.hpp.
References m::dyn_array< T >::operator==().
|
inline |
Returns true
iff the contents of this
and other
are equal, that is, they have the same number of elements and each element in this
compares equal with the element in other
at the same position.
Definition at line 363 of file ADT.hpp.
References m::dyn_array< T >::size().
Referenced by m::dyn_array< T >::operator!=().
|
inline |
Returns a reference to the element at position pos
.
Requires that pos
is in bounds.
Definition at line 335 of file ADT.hpp.
References m::dyn_array< T >::data(), M_insist, and m::dyn_array< T >::size().
|
inline |
Returns a reference to the element at position pos
.
Requires that pos
is in bounds.
Definition at line 329 of file ADT.hpp.
References m::dyn_array< T >::data(), M_insist, and m::dyn_array< T >::size().
|
inline |
Returns the size of this array, i.e.
the number of elements.
Definition at line 321 of file ADT.hpp.
References m::dyn_array< T >::size_.
Referenced by m::dyn_array< T >::at(), m::dyn_array< T >::dyn_array(), m::dyn_array< T >::end(), m::dyn_array< T >::operator==(), and m::dyn_array< T >::operator[]().
|
private |
Definition at line 285 of file ADT.hpp.
Referenced by m::dyn_array< T >::data().
|
private |
Definition at line 286 of file ADT.hpp.
Referenced by m::dyn_array< T >::size().