17 #ifndef LLVM_ADT_STLEXTRAS_H
18 #define LLVM_ADT_STLEXTRAS_H
33 struct identity :
public std::unary_function<Ty, Ty> {
43 struct less_ptr :
public std::binary_function<Ty, Ty, bool> {
45 return *left < *right;
50 struct greater_ptr :
public std::binary_function<Ty, Ty, bool> {
52 return *right < *left;
75 template <
class RootIt,
class UnaryFunc>
80 typedef typename std::iterator_traits<RootIt>::iterator_category
82 typedef typename std::iterator_traits<RootIt>::difference_type
93 inline const RootIt &
getCurrent()
const {
return current; }
94 inline const UnaryFunc &
getFunc()
const {
return Fn; }
97 : current(I), Fn(F) {}
99 : current(It.current), Fn(It.Fn) {}
110 return _Self(current + n, Fn);
114 return _Self(current - n, Fn);
124 return current - X.current;
128 template <
class _Iterator,
class Func>
129 inline mapped_iterator<_Iterator, Func>
139 template <
class ItTy,
class FuncTy>
153 template <
typename ItTy,
typename Dist>
154 inline ItTy
next(ItTy it, Dist n)
160 template <
typename ItTy>
166 template <
typename ItTy,
typename Dist>
173 template <
typename ItTy>
199 template <
typename T1,
typename T2>
215 template <
typename T1,
typename T2>
223 template <
typename T>
bool operator()(
const T &lhs,
const T &rhs)
const {
224 return lhs.first < rhs.first;
231 template <
typename T>
bool operator()(
const T &lhs,
const T &rhs)
const {
232 return lhs.second < rhs.second;
243 template<
class T, std::
size_t N>
249 template<
class T, std::
size_t N>
258 if (*reinterpret_cast<const T*>(P1) < *reinterpret_cast<const T*>(P2))
260 if (*reinterpret_cast<const T*>(P2) < *reinterpret_cast<const T*>(P1))
269 (
const void*,
const void*) {
270 return array_pod_sort_comparator<T>;
288 template<
class IteratorTy>
291 if (Start == End)
return;
292 qsort(&*Start, End-Start,
sizeof(*Start),
296 template <
class IteratorTy>
298 IteratorTy Start, IteratorTy End,
300 const typename std::iterator_traits<IteratorTy>::value_type *,
301 const typename std::iterator_traits<IteratorTy>::value_type *)) {
303 if (Start == End)
return;
304 qsort(&*Start, End - Start,
sizeof(*Start),
305 reinterpret_cast<int (*)(
const void *,
const void *)
>(
Compare));
314 template<
typename Container>
316 for (
typename Container::iterator
I = C.begin(), E = C.end();
I != E; ++
I)
323 template<
typename Container>
325 for (
typename Container::iterator
I = C.begin(), E = C.end();
I != E; ++
I)
void DeleteContainerSeconds(Container &C)
void DeleteContainerPointers(Container &C)
T * array_endof(T(&x)[N])
difference_type operator-(const _Self &X) const
const Ty & operator()(const Ty &self) const
tier(first_type f, second_type s)
Function object to check whether the second component of a std::pair compares less than the second co...
int(*)(const void *, const void *) get_array_pod_sort_comparator(const T &)
UnaryFunc::result_type value_type
int array_pod_sort_comparator(const void *P1, const void *P2)
static error_code advance(T &it, size_t Val)
mapped_iterator(const RootIt &I, UnaryFunc F)
bool operator()(const T &lhs, const T &rhs) const
mapped_iterator< ItTy, FuncTy > map_iterator(const ItTy &I, FuncTy F)
std::iterator_traits< RootIt >::iterator_category iterator_category
void operator+(int, ilist_iterator< T >) LLVM_DELETED_FUNCTION
size_t array_lengthof(T(&)[N])
Find the length of an array.
std::iterator_traits< RootIt >::difference_type difference_type
void array_pod_sort(IteratorTy Start, IteratorTy End)
mapped_iterator< RootIt, UnaryFunc > _Self
ItTy next(ItTy it, Dist n)
_Self & operator-=(difference_type n)
Ty & operator()(Ty &self) const
value_type operator*() const
_Self operator-(difference_type n) const
bool operator()(const T &lhs, const T &rhs) const
const UnaryFunc & getFunc() const
bool operator<(const _Self &X) const
bool operator!=(const _Self &X) const
bool operator()(const Ty *left, const Ty *right) const
_Self operator+(difference_type n) const
bool operator()(const Ty *left, const Ty *right) const
mapped_iterator(const mapped_iterator &It)
const RootIt & getCurrent() const
tier & operator=(const std::pair< T1, T2 > &p)
ItTy prior(ItTy it, Dist n)
bool operator==(const _Self &X) const
_Self & operator+=(difference_type n)
reference operator[](difference_type n) const
tier< T1, T2 > tie(T1 &f, T2 &s)
static RegisterPass< NVPTXAllocaHoisting > X("alloca-hoisting","Hoisting alloca instructions in non-entry ""blocks to the entry block")
Function object to check whether the first component of a std::pair compares less than the first comp...