libgrape-lite
A C++ library for parallel graph processing
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
grape::Array< _Tp, _Alloc > Class Template Reference

Array a std::vector-like container type without reserving memory. More...

#include <gcontainer.h>

Classes

struct  __Array_base
 
struct  _ConstructTransaction
 

Public Types

using pointer = _Tp *
 
using const_pointer = const _Tp *
 
using reference = _Tp &
 
using const_reference = const _Tp &
 
using size_type = size_t
 
using value_type = _Tp
 
using allocator_type = _Alloc
 
using iterator = pointer
 
using const_iterator = const_pointer
 
using __alloc_traits = std::allocator_traits< _Alloc >
 

Public Member Functions

allocator_type get_allocator () const noexcept
 
 Array (const allocator_type &__a) noexcept
 
 Array (size_type __n, const allocator_type &__a=allocator_type())
 
 Array (size_type __n, const value_type &__x, const allocator_type &__a=allocator_type())
 
 Array (const Array &__x)
 
 Array (Array &&__x) noexcept
 
 Array (const Array &__x, const allocator_type &__a)
 
 Array (Array &&__x, const allocator_type &__a)
 
Arrayoperator= (const Array &__x)
 
Arrayoperator= (Array &&__x)
 
size_type size () const noexcept
 
void resize (size_type __new_size)
 
void resize (size_type __new_size, const value_type &__x)
 
bool empty () const noexcept
 
reference operator[] (size_type __n) noexcept
 
const_reference operator[] (size_type __n) const noexcept
 
reference at (size_type __n) noexcept
 
const_reference at (size_type __n) const noexcept
 
pointer data () noexcept
 
const_pointer data () const noexcept
 
iterator begin () noexcept
 
const_iterator begin () const noexcept
 
iterator end () noexcept
 
const_iterator end () const noexcept
 
void swap (Array &__x) noexcept
 
void clear () noexcept
 

Private Member Functions

allocator_type & __alloc () noexcept
 
const allocator_type & __alloc () const noexcept
 
void __vallocate (size_type __n)
 
void __vdeallocate ()
 
void __vdeallocate (pointer __begin, size_type __size)
 
void __construct_at_end (size_type __n)
 
void __construct_at_end (size_type __n, const_reference __x)
 
template<class _ForwardIterator >
void __construct_at_end (_ForwardIterator __first, _ForwardIterator __last, size_type __n)
 
void __destruct_at_end (pointer __new_last)
 
void __destruct_at_end (pointer __new_last, pointer __end)
 
void __range_check (size_type __n) const noexcept
 

Private Attributes

__Array_base __base
 

Detailed Description

template<typename _Tp, typename _Alloc = Allocator<_Tp>>
class grape::Array< _Tp, _Alloc >

Array a std::vector-like container type without reserving memory.

Unlike std::array, Array is resizable, and unlike std::vector, Array takes exactly memory for elements without reserving spaces for further insertions.

Template Parameters
_TpType of elements in the array.
_AllocAllocator type that will be used for memory allocation.