Template Class TupleContainer< InternalContainer, std::tuple< Types… > >
Defined in File tuple_vector.hpp
Class Documentation
-
template<template<class> class InternalContainer, class ...Types>
class TupleContainer<InternalContainer, std::tuple<Types...>> An implementation of a tuple of containers, with an interface that looks like a container of tuples.
i.e. though this is implemented internally as an
std::tuple<InternalContainer<Types>...>
, the interface looks like anInternalContainer<std::tuple<Types>...>
. It provides the convenience of the second, but when iterating over only one of the elements of the tuple in the container it has better performance (because of cache locality).- Template Parameters:
InternalContainer – Container type, e.g. std::vector.
...Types – Elements types of the tuple.
Public Types
-
using size_type = std::size_t
Size type of the container.
-
using difference_type = std::ptrdiff_t
Difference type of the container.
-
using allocator_type = void
Allocator type.
This alias needs to exist to satisfy
ranges::to
container concept checks. It is not actually used, and there is no meaninful type we can specify here. See https://github.com/ericniebler/range-v3/blob/0.10.0/include/range/v3/range/conversion.hpp#L262
Public Functions
-
constexpr TupleContainer() = default
Default constructor, will default initialize all containers in the tuple.
-
inline explicit constexpr TupleContainer(size_type count)
Constructs a container of size count, all values are default initialized.
- Parameters:
count – Size of the container.
-
template<typename I, typename S>
inline constexpr TupleContainer(I first, S last) Constructs a container from iterators.
-
inline constexpr TupleContainer(std::initializer_list<value_type> init)
Constructs a container from an initializer_list.
-
inline constexpr bool empty() const noexcept
Returns true if the container is empty.
-
inline constexpr void clear() noexcept
Clears the container.
-
template<typename I, typename S>
inline constexpr void assign(I first, S last) Replaces elements in the container with copies of those in the range [first, last).
The behavior is undefined if either argument is an iterator into *this.
-
template<typename R>
inline constexpr void assign_range(R &&range) Replaces elements in the container with a copy of each element in range.
-
inline constexpr void reserve(size_type new_cap)
Reserves the specified capacity.
If the specified new capacity is greater than the current capacity, new storage is allocated. Otherwise, the method does nothing.
- Parameters:
new_cap – New capacity of the container.
-
inline constexpr void resize(size_type count)
Resizes the container.
The container is resized to have exactly
count
elements. If the specified size is less than the current size, the firstcount
elements of the container will be kept. Otherwise, the container is extended with default initialized values.- Parameters:
count – New size of the container.
-
inline constexpr void push_back(const value_type &value)
Adds an element at the end of the container.
- Parameters:
value – The element to be appended.
-
inline constexpr void push_back(value_type &&value)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
-
inline constexpr auto begin() const
Returns an iterator to the first element of the container.
-
inline constexpr auto end() const
Returns an iterator to the last element of the container.
-
inline constexpr auto begin()
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
-
inline constexpr auto end()
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.