31 #ifndef HELPER_CONTAINER_HPP_ 32 #define HELPER_CONTAINER_HPP_ 51 template<
typename T>
static void append(
54 typename T::size_type startAt,
55 typename T::size_type endAt
57 to.insert(std::end(to), std::begin(from) + startAt, std::begin(from) + endAt);
69 template<
typename T>
static void append(
72 typename T::size_type startAt
74 to.insert(std::end(to), std::begin(from) + startAt, std::end(from));
84 template<
typename T>
static void append(
88 to.insert(std::end(to), std::begin(from), std::end(from));
99 template<
typename T>
static void moveInto(T& to, T& from) {
102 std::make_move_iterator(std::begin(from)),
103 std::make_move_iterator(std::end(from))
117 template<
typename T>
static void moveInto(T& to, T& from,
typename T::size_type at) {
120 std::make_move_iterator(std::begin(from)),
121 std::make_move_iterator(std::end(from))
133 template<
typename T>
static void eraseFirst(T& container,
typename T::size_type n) {
134 container.erase(std::begin(container), std::begin(container) + n);
144 template<
typename T>
static typename T::size_type
bytes(
const T& container) {
145 return std::accumulate(
146 std::begin(container),
148 typename T::size_type{},
149 [](
const auto size,
const auto& element) {
150 return size + element.size();
static void eraseFirst(T &container, typename T::size_type n)
Erases the first elements of an iterable container.
Definition: Container.hpp:133
static void moveInto(T &to, T &from)
Moves the elements of an iterable container into another iterable container.
Definition: Container.hpp:99
static T::size_type bytes(const T &container)
Returns the number of bytes in an iterable container.
Definition: Container.hpp:144
static void append(T &to, const T &from, typename T::size_type startAt, typename T::size_type endAt)
Appends (part of) an iterable container to another container.
Definition: Container.hpp:51
Namespace for global container helper function templates.
Definition: Container.hpp:38