FlatImage
A configurable Linux containerization system
Loading...
Searching...
No Matches
ns_vector Namespace Reference

Vector and container manipulation utilities. More...

Functions

template<ns_concept::Iterable R1, ns_concept::Iterable R2>
void append_range (R1 &to, R2 const &from) noexcept
 Appends a range of values from a src to a dst.
 
template<ns_concept::Iterable R, typename... Args>
requires ( std::convertible_to<Args, typename R::value_type> && ... )
void push_back (R &r, Args &&... args) noexcept
 Helper to push back multiple elements into an input iterator.
 
template<ns_concept::Iterable R, typename... Args>
requires ( std::convertible_to<Args, typename R::value_type> && ... )
void push_front (R &r, Args &&... args) noexcept
 Helper to prepend multiple elements to the front of a container.
 
template<ns_concept::Iterable R = std::vector<std::string>>
from_string (ns_concept::StringRepresentable auto &&t, char delimiter) noexcept
 Creates a range from a string.
 

Detailed Description

Vector and container manipulation utilities.

This namespace provides utility functions for working with std::vector and other standard library containers. It includes operations for appending ranges, pushing multiple elements at once, prepending elements to the front of a container, and creating containers from delimited strings.

Function Documentation

◆ append_range()

void ns_vector::append_range ( R1 & to,
R2 const & from )
inlinenoexcept

Appends a range of values from a src to a dst.

This is available in C++23, not implemented yet on gcc however

Template Parameters
R1An iterable type
R2An iterable type
Parameters
toThe target to push elements into
fromThe source to read elements from

Definition at line 39 of file vector.hpp.

◆ from_string()

template<ns_concept::Iterable R = std::vector<std::string>>
R ns_vector::from_string ( ns_concept::StringRepresentable auto && t,
char delimiter )
inlinenoexcept

Creates a range from a string.

Template Parameters
RA container type, defaults to std::vector<std::string>
Parameters
tThe string representable value to convert into a container
delimiterThe delimiter to split elements in the string
Returns
R The container built from separating the string with the given delimiter

Definition at line 84 of file vector.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ push_back()

template<ns_concept::Iterable R, typename... Args>
requires ( std::convertible_to<Args, typename R::value_type> && ... )
void ns_vector::push_back ( R & r,
Args &&... args )
inlinenoexcept

Helper to push back multiple elements into an input iterator.

Template Parameters
RAn iterable type
ArgsType of the arguments to push back
Parameters
rThe range to push elements into
argsThe arguments to push into the range

Definition at line 54 of file vector.hpp.

Here is the caller graph for this function:

◆ push_front()

template<ns_concept::Iterable R, typename... Args>
requires ( std::convertible_to<Args, typename R::value_type> && ... )
void ns_vector::push_front ( R & r,
Args &&... args )
inlinenoexcept

Helper to prepend multiple elements to the front of a container.

Template Parameters
RAn iterable type
ArgsType of the arguments to prepend
Parameters
rThe container to prepend elements into
argsThe arguments to prepend to the container

Definition at line 69 of file vector.hpp.

Here is the caller graph for this function: