C/C++ API Reference
Loading...
Searching...
No Matches
Utilities

Oveview

Classes

class  pw::containers::FilteredView< Container, Filter >
 
class  pw::containers::FilteredView< Container, Filter >::iterator
 
class  pw::containers::internal::PtrIterator< Iterator, Container >
 
class  pw::containers::PtrIterator< Container >
 
class  pw::containers::ConstPtrIterator< Container >
 
class  pw::containers::WrappedIterator< Impl, Iterator, ValueType >
 

Typedefs

using pw::containers::FilteredView< Container, Filter >::iterator::difference_type = std::ptrdiff_t
 
using pw::containers::FilteredView< Container, Filter >::iterator::value_type = typename Container::value_type
 
using pw::containers::FilteredView< Container, Filter >::iterator::pointer = typename Container::pointer
 
using pw::containers::FilteredView< Container, Filter >::iterator::reference = typename Container::reference
 
using pw::containers::FilteredView< Container, Filter >::iterator::iterator_category = std::bidirectional_iterator_tag
 
using pw::containers::FilteredView< Container, Filter >::const_iterator = iterator
 
using pw::containers::internal::PtrIterator< Iterator, Container >::value_type = typename Container::value_type
 
using pw::containers::internal::PtrIterator< Iterator, Container >::difference_type = std::ptrdiff_t
 
using pw::containers::internal::PtrIterator< Iterator, Container >::reference = typename std::conditional_t< std::is_const_v< Container >, typename Container::const_reference, typename Container::reference >
 
using pw::containers::internal::PtrIterator< Iterator, Container >::pointer = typename std::conditional_t< std::is_const_v< Container >, typename Container::const_pointer, typename Container::pointer >
 
using pw::containers::internal::PtrIterator< Iterator, Container >::iterator_category = containers::contiguous_iterator_tag
 
using pw::containers::WrappedIterator< Impl, Iterator, ValueType >::difference_type = std::ptrdiff_t
 
using pw::containers::WrappedIterator< Impl, Iterator, ValueType >::value_type = ValueType
 
using pw::containers::WrappedIterator< Impl, Iterator, ValueType >::pointer = ValueType *
 
using pw::containers::WrappedIterator< Impl, Iterator, ValueType >::reference = ValueType &
 
using pw::containers::WrappedIterator< Impl, Iterator, ValueType >::iterator_category = std::bidirectional_iterator_tag
 

Functions

template<typename C , typename Pred >
bool pw::containers::AllOf (const C &c, Pred &&pred)
 
template<typename C , typename Pred >
bool pw::containers::AnyOf (const C &c, Pred &&pred)
 
template<typename C , typename Pred >
bool pw::containers::NoneOf (const C &c, Pred &&pred)
 
template<typename C , typename Function >
std::decay_t< Functionpw::containers::ForEach (C &&c, Function &&f)
 
template<typename C , typename T >
internal_algorithm::ContainerIter< C > pw::containers::Find (C &c, T &&value)
 
template<typename C , typename Pred >
internal_algorithm::ContainerIter< C > pw::containers::FindIf (C &c, Pred &&pred)
 
template<typename C , typename Pred >
internal_algorithm::ContainerIter< C > pw::containers::FindIfNot (C &c, Pred &&pred)
 
template<typename Sequence1 , typename Sequence2 >
internal_algorithm::ContainerIter< Sequence1 > pw::containers::FindEnd (Sequence1 &sequence, Sequence2 &subsequence)
 
template<typename Sequence1 , typename Sequence2 , typename BinaryPredicate >
internal_algorithm::ContainerIter< Sequence1 > pw::containers::FindEnd (Sequence1 &sequence, Sequence2 &subsequence, BinaryPredicate &&pred)
 
template<typename C1 , typename C2 >
internal_algorithm::ContainerIter< C1 > pw::containers::FindFirstOf (C1 &container, C2 &options)
 
template<typename C1 , typename C2 , typename BinaryPredicate >
internal_algorithm::ContainerIter< C1 > pw::containers::FindFirstOf (C1 &container, C2 &options, BinaryPredicate &&pred)
 
template<typename Sequence >
internal_algorithm::ContainerIter< Sequence > pw::containers::AdjacentFind (Sequence &sequence)
 
template<typename Sequence , typename BinaryPredicate >
internal_algorithm::ContainerIter< Sequence > pw::containers::AdjacentFind (Sequence &sequence, BinaryPredicate &&pred)
 
template<typename C , typename T >
internal_algorithm::ContainerDifferenceType< const C > pw::containers::Count (const C &c, T &&value)
 
template<typename C , typename Pred >
internal_algorithm::ContainerDifferenceType< const C > pw::containers::CountIf (const C &c, Pred &&pred)
 
template<typename C1 , typename C2 >
internal_algorithm::ContainerIterPairType< C1, C2 > pw::containers::Mismatch (C1 &c1, C2 &c2)
 
template<typename C1 , typename C2 , typename BinaryPredicate >
internal_algorithm::ContainerIterPairType< C1, C2 > pw::containers::Mismatch (C1 &c1, C2 &c2, BinaryPredicate pred)
 
template<typename C1 , typename C2 >
bool pw::containers::Equal (const C1 &c1, const C2 &c2)
 
template<typename C1 , typename C2 , typename BinaryPredicate >
bool pw::containers::Equal (const C1 &c1, const C2 &c2, BinaryPredicate &&pred)
 
template<typename C1 , typename C2 >
bool pw::containers::IsPermutation (const C1 &c1, const C2 &c2)
 
template<typename C1 , typename C2 , typename BinaryPredicate >
bool pw::containers::IsPermutation (const C1 &c1, const C2 &c2, BinaryPredicate &&pred)
 
template<typename Sequence1 , typename Sequence2 >
internal_algorithm::ContainerIter< Sequence1 > pw::containers::Search (Sequence1 &sequence, Sequence2 &subsequence)
 
template<typename Sequence1 , typename Sequence2 , typename BinaryPredicate >
internal_algorithm::ContainerIter< Sequence1 > pw::containers::Search (Sequence1 &sequence, Sequence2 &subsequence, BinaryPredicate &&pred)
 
template<typename Sequence , typename Size , typename T >
internal_algorithm::ContainerIter< Sequence > pw::containers::SearchN (Sequence &sequence, Size count, T &&value)
 
template<typename Sequence , typename Size , typename T , typename BinaryPredicate >
internal_algorithm::ContainerIter< Sequence > pw::containers::SearchN (Sequence &sequence, Size count, T &&value, BinaryPredicate &&pred)
 
template<typename InputIt , typename Predicate >
constexpr bool pw::all_of (InputIt first, InputIt last, Predicate pred)
 constexpr backport of <algorithm>'s std::all_of for C++17.
 
template<typename InputIt , typename Predicate >
constexpr bool pw::any_of (InputIt first, InputIt last, Predicate pred)
 constexpr backport of <algorithm>'s std::any_of for C++17.
 
template<typename InputIt , typename Predicate >
constexpr InputIt pw::find_if (InputIt first, InputIt last, Predicate pred)
 constexpr backport of <algorithm>'s std::find_if for C++17.
 
template<typename ForwardIt , typename T >
constexpr void pw::fill (ForwardIt begin, ForwardIt end, const T &value)
 constexpr backport of <algorithm>'s std::fill for C++17.
 
template<typename It , typename Size , typename T >
constexpr It pw::fill_n (It begin, Size count, const T &value)
 constexpr backport of <algorithm>'s std::fill_n for C++17.
 
iteratorpw::containers::FilteredView< Container, Filter >::iterator::operator++ ()
 
iterator pw::containers::FilteredView< Container, Filter >::iterator::operator++ (int)
 
iteratorpw::containers::FilteredView< Container, Filter >::iterator::operator-- ()
 
iterator pw::containers::FilteredView< Container, Filter >::iterator::operator-- (int)
 
const auto & pw::containers::FilteredView< Container, Filter >::iterator::operator* () const
 
const auto * pw::containers::FilteredView< Container, Filter >::iterator::operator-> () const
 
constexpr bool pw::containers::FilteredView< Container, Filter >::iterator::operator== (const iterator &other) const
 
constexpr bool pw::containers::FilteredView< Container, Filter >::iterator::operator!= (const iterator &other) const
 
constexpr pw::containers::FilteredView< Container, Filter >::FilteredView (const Container &container, const Filter &filter)
 
constexpr pw::containers::FilteredView< Container, Filter >::FilteredView (const Container &container, Filter &&filter)
 
constexpr pw::containers::FilteredView< Container, Filter >::FilteredView (FilteredView &&)=default
 
constexpr FilteredViewpw::containers::FilteredView< Container, Filter >::operator= (FilteredView &&)=default
 
constexpr pw::containers::FilteredView< Container, Filter >::FilteredView (const FilteredView &)=delete
 
constexpr FilteredViewpw::containers::FilteredView< Container, Filter >::operator= (const FilteredView &)=delete
 
const auto & pw::containers::FilteredView< Container, Filter >::operator[] (size_t index) const
 
const auto & pw::containers::FilteredView< Container, Filter >::front () const
 
const auto & pw::containers::FilteredView< Container, Filter >::back () const
 
size_t pw::containers::FilteredView< Container, Filter >::size () const
 
bool pw::containers::FilteredView< Container, Filter >::empty () const
 
iterator pw::containers::FilteredView< Container, Filter >::begin () const
 
iterator pw::containers::FilteredView< Container, Filter >::end () const
 
constexpr reference pw::containers::internal::PtrIterator< Iterator, Container >::operator* () const
 
constexpr pointer pw::containers::internal::PtrIterator< Iterator, Container >::operator-> () const
 
constexpr Iterator & pw::containers::internal::PtrIterator< Iterator, Container >::operator++ ()
 
constexpr Iterator & pw::containers::internal::PtrIterator< Iterator, Container >::operator-- ()
 
constexpr Iterator pw::containers::internal::PtrIterator< Iterator, Container >::operator++ (int)
 
constexpr Iterator pw::containers::internal::PtrIterator< Iterator, Container >::operator-- (int)
 
constexpr Iterator & pw::containers::internal::PtrIterator< Iterator, Container >::operator+= (difference_type n)
 
constexpr Iterator & pw::containers::internal::PtrIterator< Iterator, Container >::operator-= (difference_type n)
 
constexpr reference pw::containers::internal::PtrIterator< Iterator, Container >::operator[] (difference_type n) const
 
constexpr pw::containers::internal::PtrIterator< Iterator, Container >::PtrIterator (pointer ptr)
 
constexpr pw::containers::ConstPtrIterator< Container >::ConstPtrIterator (PtrIterator< Container > other)
 
template<typename T , size_t kSize, size_t... kIndices>
constexpr std::array< std::remove_cv_t< T >, kSize > pw::containers::impl::CopyArray (const T(&values)[kSize], std::index_sequence< kIndices... >)
 
template<typename T , size_t kSize, size_t... kIndices>
constexpr std::array< std::remove_cv_t< T >, kSize > pw::containers::impl::MoveArray (T(&&values)[kSize], std::index_sequence< kIndices... >)
 
template<typename T , size_t kSize>
constexpr std::array< std::remove_cv_t< T >, kSize > pw::containers::to_array (T(&values)[kSize])
 
template<typename T , size_t kSize>
constexpr std::array< std::remove_cv_t< T >, kSize > pw::containers::to_array (T(&&values)[kSize])
 
constexpr pw::containers::WrappedIterator< Impl, Iterator, ValueType >::WrappedIterator (const WrappedIterator &)=default
 
constexpr WrappedIteratorpw::containers::WrappedIterator< Impl, Iterator, ValueType >::operator= (const WrappedIterator &)=default
 
Impl & pw::containers::WrappedIterator< Impl, Iterator, ValueType >::operator++ ()
 
Impl pw::containers::WrappedIterator< Impl, Iterator, ValueType >::operator++ (int)
 
Impl & pw::containers::WrappedIterator< Impl, Iterator, ValueType >::operator-- ()
 
Impl pw::containers::WrappedIterator< Impl, Iterator, ValueType >::operator-- (int)
 
constexpr bool pw::containers::WrappedIterator< Impl, Iterator, ValueType >::operator== (const WrappedIterator &other) const
 
constexpr bool pw::containers::WrappedIterator< Impl, Iterator, ValueType >::operator!= (const WrappedIterator &other) const
 
constexpr pw::containers::WrappedIterator< Impl, Iterator, ValueType >::WrappedIterator (const Iterator &it)
 
const auto & pw::containers::WrappedIterator< Impl, Iterator, ValueType >::value () const
 
const auto * pw::containers::WrappedIterator< Impl, Iterator, ValueType >::ptr () const
 

Friends

class pw::containers::FilteredView< Container, Filter >::iterator::FilteredView
 
constexpr Iterator pw::containers::internal::PtrIterator< Iterator, Container >::operator+ (Iterator it, difference_type n)
 
constexpr Iterator pw::containers::internal::PtrIterator< Iterator, Container >::operator+ (difference_type n, Iterator it)
 
constexpr Iterator pw::containers::internal::PtrIterator< Iterator, Container >::operator- (Iterator it, difference_type n)
 
constexpr difference_type pw::containers::internal::PtrIterator< Iterator, Container >::operator- (Iterator lhs, Iterator rhs)
 
constexpr bool pw::containers::internal::PtrIterator< Iterator, Container >::operator== (Iterator lhs, Iterator rhs)
 
constexpr bool pw::containers::internal::PtrIterator< Iterator, Container >::operator!= (Iterator lhs, Iterator rhs)
 
constexpr bool pw::containers::internal::PtrIterator< Iterator, Container >::operator< (Iterator lhs, Iterator rhs)
 
constexpr bool pw::containers::internal::PtrIterator< Iterator, Container >::operator<= (Iterator lhs, Iterator rhs)
 
constexpr bool pw::containers::internal::PtrIterator< Iterator, Container >::operator> (Iterator lhs, Iterator rhs)
 
constexpr bool pw::containers::internal::PtrIterator< Iterator, Container >::operator>= (Iterator lhs, Iterator rhs)
 

Function Documentation

◆ AdjacentFind() [1/2]

template<typename Sequence >
internal_algorithm::ContainerIter< Sequence > pw::containers::AdjacentFind ( Sequence &  sequence)

Container-based version of the <algorithm> std::adjacent_find() function to find equal adjacent elements within a container.

◆ AdjacentFind() [2/2]

template<typename Sequence , typename BinaryPredicate >
internal_algorithm::ContainerIter< Sequence > pw::containers::AdjacentFind ( Sequence &  sequence,
BinaryPredicate &&  pred 
)

Overload of AdjacentFind() for using a predicate evaluation other than == as the function's test condition.

◆ AllOf()

template<typename C , typename Pred >
bool pw::containers::AllOf ( const C &  c,
Pred &&  pred 
)

Container-based version of the <algorithm> std::all_of() function to test if all elements within a container satisfy a condition.

◆ AnyOf()

template<typename C , typename Pred >
bool pw::containers::AnyOf ( const C &  c,
Pred &&  pred 
)

Container-based version of the <algorithm> std::any_of() function to test if any element in a container fulfills a condition.

◆ Count()

template<typename C , typename T >
internal_algorithm::ContainerDifferenceType< const C > pw::containers::Count ( const C &  c,
T &&  value 
)

Container-based version of the <algorithm> std::count() function to count values that match within a container.

◆ CountIf()

template<typename C , typename Pred >
internal_algorithm::ContainerDifferenceType< const C > pw::containers::CountIf ( const C &  c,
Pred &&  pred 
)

Container-based version of the <algorithm> std::count_if() function to count values matching a condition within a container.

◆ Equal() [1/2]

template<typename C1 , typename C2 >
bool pw::containers::Equal ( const C1 &  c1,
const C2 &  c2 
)

Container-based version of the <algorithm> std::equal() function to test whether two containers are equal.

Note
The semantics of Equal() are slightly different than those of std::equal(). While the latter iterates over the second container only up to the size of the first container, Equal() also checks whether the container sizes are equal. This better matches expectations about Equal() based on its signature.
vector v1 = <1, 2, 3>;
vector v2 = <1, 2, 3, 4>;
EXPECT_TRUE(equal(std::begin(v1), std::end(v1), std::begin(v2)));
EXPECT_FALSE(Equal(v1, v2));
bool Equal(const C1 &c1, const C2 &c2)
Definition: algorithm.h:241

◆ Equal() [2/2]

template<typename C1 , typename C2 , typename BinaryPredicate >
bool pw::containers::Equal ( const C1 &  c1,
const C2 &  c2,
BinaryPredicate &&  pred 
)

Overload of Equal() for using a predicate evaluation other than == as the function's test condition.

◆ Find()

template<typename C , typename T >
internal_algorithm::ContainerIter< C > pw::containers::Find ( C &  c,
T &&  value 
)

Container-based version of the <algorithm> std::find() function to find the first element containing the passed value within a container value.

◆ FindEnd() [1/2]

template<typename Sequence1 , typename Sequence2 >
internal_algorithm::ContainerIter< Sequence1 > pw::containers::FindEnd ( Sequence1 &  sequence,
Sequence2 &  subsequence 
)

Container-based version of the <algorithm> std::find_end() function to find the last subsequence within a container.

◆ FindEnd() [2/2]

template<typename Sequence1 , typename Sequence2 , typename BinaryPredicate >
internal_algorithm::ContainerIter< Sequence1 > pw::containers::FindEnd ( Sequence1 &  sequence,
Sequence2 &  subsequence,
BinaryPredicate &&  pred 
)

Overload of FindEnd() for using a predicate evaluation other than == as the function's test condition.

◆ FindFirstOf() [1/2]

template<typename C1 , typename C2 >
internal_algorithm::ContainerIter< C1 > pw::containers::FindFirstOf ( C1 &  container,
C2 &  options 
)

Container-based version of the <algorithm> std::find_first_of() function to find the first element within the container that is also within the options container.

◆ FindFirstOf() [2/2]

template<typename C1 , typename C2 , typename BinaryPredicate >
internal_algorithm::ContainerIter< C1 > pw::containers::FindFirstOf ( C1 &  container,
C2 &  options,
BinaryPredicate &&  pred 
)

Overload of FindFirstOf() for using a predicate evaluation other than == as the function's test condition.

◆ FindIf()

template<typename C , typename Pred >
internal_algorithm::ContainerIter< C > pw::containers::FindIf ( C &  c,
Pred &&  pred 
)

Container-based version of the <algorithm> std::find_if() function to find the first element in a container matching the given condition.

◆ FindIfNot()

template<typename C , typename Pred >
internal_algorithm::ContainerIter< C > pw::containers::FindIfNot ( C &  c,
Pred &&  pred 
)

Container-based version of the <algorithm> std::find_if_not() function to find the first element in a container not matching the given condition.

◆ ForEach()

template<typename C , typename Function >
std::decay_t< Function > pw::containers::ForEach ( C &&  c,
Function &&  f 
)

Container-based version of the <algorithm> std::for_each() function to apply a function to a container's elements.

◆ IsPermutation() [1/2]

template<typename C1 , typename C2 >
bool pw::containers::IsPermutation ( const C1 &  c1,
const C2 &  c2 
)

Container-based version of the <algorithm> std::is_permutation() function to test whether a container is a permutation of another.`

◆ IsPermutation() [2/2]

template<typename C1 , typename C2 , typename BinaryPredicate >
bool pw::containers::IsPermutation ( const C1 &  c1,
const C2 &  c2,
BinaryPredicate &&  pred 
)

Overload of IsPermutation() for using a predicate evaluation other than == as the function's test condition.

◆ Mismatch() [1/2]

template<typename C1 , typename C2 >
internal_algorithm::ContainerIterPairType< C1, C2 > pw::containers::Mismatch ( C1 &  c1,
C2 &  c2 
)

Container-based version of the <algorithm> std::mismatch() function to return the first element where two ordered containers differ. Applies == to the first N elements of c1 and c2, where N = min(size(c1), size(c2)).

◆ Mismatch() [2/2]

template<typename C1 , typename C2 , typename BinaryPredicate >
internal_algorithm::ContainerIterPairType< C1, C2 > pw::containers::Mismatch ( C1 &  c1,
C2 &  c2,
BinaryPredicate  pred 
)

Overload of Mismatch() for using a predicate evaluation other than == as the function's test condition. Applies predto the first N elements of c1 and c2, where N = min(size(c1), size(c2)).

◆ NoneOf()

template<typename C , typename Pred >
bool pw::containers::NoneOf ( const C &  c,
Pred &&  pred 
)

Container-based version of the <algorithm> std::none_of() function to test if no elements in a container fulfill a condition.

◆ Search() [1/2]

template<typename Sequence1 , typename Sequence2 >
internal_algorithm::ContainerIter< Sequence1 > pw::containers::Search ( Sequence1 &  sequence,
Sequence2 &  subsequence 
)

Container-based version of the <algorithm> std::search() function to search a container for a subsequence.

◆ Search() [2/2]

template<typename Sequence1 , typename Sequence2 , typename BinaryPredicate >
internal_algorithm::ContainerIter< Sequence1 > pw::containers::Search ( Sequence1 &  sequence,
Sequence2 &  subsequence,
BinaryPredicate &&  pred 
)

Overload of Search() for using a predicate evaluation other than == as the function's test condition.

◆ SearchN() [1/2]

template<typename Sequence , typename Size , typename T >
internal_algorithm::ContainerIter< Sequence > pw::containers::SearchN ( Sequence &  sequence,
Size  count,
T &&  value 
)

Container-based version of the <algorithm> std::search_n() function to search a container for the first sequence of N elements.

◆ SearchN() [2/2]

template<typename Sequence , typename Size , typename T , typename BinaryPredicate >
internal_algorithm::ContainerIter< Sequence > pw::containers::SearchN ( Sequence &  sequence,
Size  count,
T &&  value,
BinaryPredicate &&  pred 
)

Overload of SearchN() for using a predicate evaluation other than == as the function's test condition.

◆ to_array()

template<typename T , size_t kSize>
constexpr std::array< std::remove_cv_t< T >, kSize > pw::containers::to_array ( T(&)  values[kSize])
constexpr

If C++20's std::to_array is not available, implement pw::containers::to_array in a C++14-compatible way.