18 #ifndef TRINITY_CONTAINERS_H
19 #define TRINITY_CONTAINERS_H
38 while (list_size > size)
40 typename std::list<T>::iterator itr = list.begin();
47 template<
class T,
class Predicate>
51 std::list<T> listCopy;
52 for (
typename std::list<T>::iterator itr = list.begin(); itr != list.end(); ++itr)
54 listCopy.push_back(*itr);
70 typename C::const_iterator it = container.begin();
88 std::discrete_distribution<uint32> dd(ddParam);
89 typename C::const_iterator it = container.begin();
102 template <
class C,
class Fn>
105 std::vector<double> weights;
106 weights.reserve(container.size());
107 double weightSum = 0.0;
108 for (
auto itr = container.begin(); itr != container.end(); ++itr)
110 double weight = weightExtractor(*itr);
111 weights.push_back(weight);
114 if (weightSum <= 0.0)
115 weights.assign(container.size(), 1.0);
132 template<
class Iterator1,
class Iterator2>
133 bool Intersects(Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2)
135 while (first1 != last1 && first2 != last2)
137 if (*first1 < *first2)
139 else if (*first2 < *first1)
148 template<
class K,
class V,
template<
class,
class,
class...>
class M,
class... Rest>
151 auto range = multimap.equal_range(key);
152 for (
auto itr = range.first; itr != range.second;)
154 if (itr->second == value)
155 itr = multimap.erase(itr);
C::value_type const & SelectRandomContainerElement(C const &container)
Definition: Containers.h:68
C::const_iterator SelectRandomWeightedContainerElement(C const &container, std::vector< double > weights)
Definition: Containers.h:85
void RandomResizeList(std::list< T > &list, uint32 size)
Definition: Containers.h:34
void advance(octet_iterator &it, distance_type n, octet_iterator end)
Definition: checked.h:190
static SFMTEngine & Instance()
Definition: Random.cpp:79
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
uint32_t uint32
Definition: Define.h:150
bool Intersects(Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2)
Definition: Containers.h:133
void MultimapErasePair(M< K, V, Rest...> &multimap, K const &key, V const &value)
Definition: Containers.h:149
const FieldDescriptor value
Definition: descriptor.h:1522
uint32_t uint32
Definition: g3dmath.h:168