TrinityCore
Trinity::Containers Namespace Reference

Namespaces

namespace  Impl
 
namespace  Lists
 

Classes

class  FlatSet
 

Functions

template<class M >
auto MapGetValuePtr (M &map, typename M::key_type const &key)
 
template<class K , class V , template< class, class, class... > class M, class... Rest>
void MultimapErasePair (M< K, V, Rest... > &multimap, K const &key, V const &value)
 
template<class C >
void RandomResize (C &container, std::size_t requestedSize)
 
template<class C , class Predicate >
void RandomResize (C &container, Predicate &&predicate, std::size_t requestedSize)
 
template<class C >
auto SelectRandomContainerElement (C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
 
template<class C >
auto SelectRandomWeightedContainerElement (C const &container, std::span< double > const &weights) -> decltype(std::begin(container))
 
template<class C , class Fn >
auto SelectRandomWeightedContainerElement (C const &container, Fn weightExtractor) -> decltype(std::begin(container))
 
template<class Iterator >
void RandomShuffle (Iterator begin, Iterator end)
 Reorder the elements of the iterator range randomly. More...
 
template<class C >
void RandomShuffle (C &container)
 Reorder the elements of the container randomly. More...
 
template<class Iterator1 , class Iterator2 >
bool Intersects (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2)
 
template<class Iterator1 , class Iterator2 , class Predicate >
bool Intersects (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, Predicate &&equalPred)
 
template<typename Container , typename Predicate >
void EraseIf (Container &c, Predicate p)
 
template<typename T >
decltype(auto) EnsureWritableVectorIndex (std::vector< T > &vec, typename std::vector< T >::size_type i)
 
template<typename T >
decltype(auto) EnsureWritableVectorIndex (std::vector< T > &vec, typename std::vector< T >::size_type i, T const &resizeDefault)
 
template<typename Container , typename NeedleContainer , typename ContainsOperator = bool(std::string const&, std::string const&), typename T = void>
auto FuzzyFindIn (Container const &container, NeedleContainer const &needles, ContainsOperator const &contains=StringContainsStringI, int(*bonus)(decltype((*std::begin(std::declval< Container >()))))=nullptr)
 
template<typename iterator , class end_iterator = iterator>
constexpr IteratorPair< iterator, end_iterator > MakeIteratorPair (iterator first, end_iterator second)
 
template<typename iterator , class end_iterator = iterator>
constexpr IteratorPair< iterator, end_iterator > MakeIteratorPair (std::pair< iterator, end_iterator > iterators)
 
template<class M >
auto MapEqualRange (M &map, typename M::key_type const &key)
 

Function Documentation

◆ EnsureWritableVectorIndex() [1/2]

template<typename T >
decltype(auto) Trinity::Containers::EnsureWritableVectorIndex ( std::vector< T > &  vec,
typename std::vector< T >::size_type  i 
)
inline

Returns a mutable reference to element at index i Will resize vector if neccessary to ensure element at i can be safely written

This exists as separate overload instead of one function with default argument to allow using with vectors of non-default-constructible classes

Definition at line 295 of file Containers.h.

+ Here is the caller graph for this function:

◆ EnsureWritableVectorIndex() [2/2]

template<typename T >
decltype(auto) Trinity::Containers::EnsureWritableVectorIndex ( std::vector< T > &  vec,
typename std::vector< T >::size_type  i,
T const &  resizeDefault 
)
inline

Returns a mutable reference to element at index i Will resize vector if neccessary to ensure element at i can be safely written

This overload allows specifying what value to pad vector with during .resize

Definition at line 310 of file Containers.h.

◆ EraseIf()

template<typename Container , typename Predicate >
void Trinity::Containers::EraseIf ( Container &  c,
Predicate  p 
)

Definition at line 279 of file Containers.h.

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

◆ FuzzyFindIn()

template<typename Container , typename NeedleContainer , typename ContainsOperator = bool(std::string const&, std::string const&), typename T = void>
auto Trinity::Containers::FuzzyFindIn ( Container const &  container,
NeedleContainer const &  needles,
ContainsOperator const &  contains = StringContainsStringI,
int(*)(decltype((*std::begin(std::declval< Container >()))))  bonus = nullptr 
)

Definition at line 30 of file FuzzyFind.h.

◆ Intersects() [1/2]

template<class Iterator1 , class Iterator2 >
bool Trinity::Containers::Intersects ( Iterator1  first1,
Iterator1  last1,
Iterator2  first2,
Iterator2  last2 
)
inline

Definition at line 201 of file Containers.h.

+ Here is the caller graph for this function:

◆ Intersects() [2/2]

template<class Iterator1 , class Iterator2 , class Predicate >
bool Trinity::Containers::Intersects ( Iterator1  first1,
Iterator1  last1,
Iterator2  first2,
Iterator2  last2,
Predicate &&  equalPred 
)
inline

Definition at line 230 of file Containers.h.

◆ MakeIteratorPair() [1/2]

template<typename iterator , class end_iterator = iterator>
constexpr IteratorPair< iterator, end_iterator > Trinity::Containers::MakeIteratorPair ( iterator  first,
end_iterator  second 
)
constexpr

Definition at line 48 of file IteratorPair.h.

+ Here is the caller graph for this function:

◆ MakeIteratorPair() [2/2]

template<typename iterator , class end_iterator = iterator>
constexpr IteratorPair< iterator, end_iterator > Trinity::Containers::MakeIteratorPair ( std::pair< iterator, end_iterator >  iterators)
constexpr

Definition at line 54 of file IteratorPair.h.

◆ MapEqualRange()

template<class M >
auto Trinity::Containers::MapEqualRange ( M &  map,
typename M::key_type const &  key 
)

Definition at line 60 of file IteratorPair.h.

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

◆ MapGetValuePtr()

template<class M >
auto Trinity::Containers::MapGetValuePtr ( M &  map,
typename M::key_type const &  key 
)

Returns a pointer to mapped value (or the value itself if map stores pointers)

Definition at line 29 of file MapUtils.h.

◆ MultimapErasePair()

template<class K , class V , template< class, class, class... > class M, class... Rest>
void Trinity::Containers::MultimapErasePair ( M< K, V, Rest... > &  multimap,
K const &  key,
V const &  value 
)

Definition at line 39 of file MapUtils.h.

+ Here is the caller graph for this function:

◆ RandomResize() [1/2]

template<class C , class Predicate >
void Trinity::Containers::RandomResize ( C &  container,
Predicate &&  predicate,
std::size_t  requestedSize 
)

First use predicate filter

Definition at line 91 of file Containers.h.

+ Here is the call graph for this function:

◆ RandomResize() [2/2]

template<class C >
void Trinity::Containers::RandomResize ( C &  container,
std::size_t  requestedSize 
)

Definition at line 67 of file Containers.h.

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

◆ RandomShuffle() [1/2]

template<class C >
void Trinity::Containers::RandomShuffle ( C &  container)
inline

Reorder the elements of the container randomly.

Parameters
containerContainer to reorder

Definition at line 183 of file Containers.h.

+ Here is the call graph for this function:

◆ RandomShuffle() [2/2]

template<class Iterator >
void Trinity::Containers::RandomShuffle ( Iterator  begin,
Iterator  end 
)
inline

Reorder the elements of the iterator range randomly.

Parameters
beginBeginning of the range to reorder
endEnd of the range to reorder

Definition at line 170 of file Containers.h.

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

◆ SelectRandomContainerElement()

template<class C >
auto Trinity::Containers::SelectRandomContainerElement ( C const &  container) -> typename std::add_const<decltype(*std::begin(container))>::type&
inline

Definition at line 109 of file Containers.h.

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

◆ SelectRandomWeightedContainerElement() [1/2]

template<class C , class Fn >
auto Trinity::Containers::SelectRandomWeightedContainerElement ( C const &  container,
Fn  weightExtractor 
) -> decltype(std::begin(container))
inline

Definition at line 142 of file Containers.h.

+ Here is the call graph for this function:

◆ SelectRandomWeightedContainerElement() [2/2]

template<class C >
auto Trinity::Containers::SelectRandomWeightedContainerElement ( C const &  container,
std::span< double > const &  weights 
) -> decltype(std::begin(container))
inline

Definition at line 126 of file Containers.h.

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