LLVM  8.0.1
Classes | Namespaces | Typedefs | Functions | Variables
STLExtras.h File Reference
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/iterator.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Config/abi-breaking.h"
#include "llvm/Support/ErrorHandling.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <functional>
#include <initializer_list>
#include <iterator>
#include <limits>
#include <memory>
#include <tuple>
#include <type_traits>
#include <utility>
Include dependency graph for STLExtras.h:

Go to the source code of this file.

Classes

struct  llvm::SameType< T, T >
 
struct  llvm::negation< T >
 
struct  llvm::conjunction<... >
 
struct  llvm::conjunction< B1 >
 
struct  llvm::conjunction< B1, Bn... >
 
struct  llvm::make_const_ptr< T >
 
struct  llvm::make_const_ref< T >
 
struct  llvm::identity< Ty >
 
struct  llvm::less_ptr< Ty >
 
struct  llvm::greater_ptr< Ty >
 
class  llvm::function_ref< Fn >
 An efficient, type-erasing, non-owning reference to a callable. More...
 
class  llvm::function_ref< Ret(Params...)>
 
class  llvm::mapped_iterator< ItTy, FuncTy, FuncReturnTy >
 
class  llvm::has_rbegin_impl< Ty >
 Helper to determine if type T has a member called rbegin(). More...
 
struct  llvm::has_rbegin< Ty >
 Metafunction to determine if T& or T has a member called rbegin(). More...
 
class  llvm::filter_iterator_base< WrappedIteratorT, PredicateT, IterTag >
 An iterator adaptor that filters the elements of given inner iterators. More...
 
class  llvm::filter_iterator_impl< WrappedIteratorT, PredicateT, IterTag >
 Specialization of filter_iterator_base for forward iteration only. More...
 
class  llvm::filter_iterator_impl< WrappedIteratorT, PredicateT, std::bidirectional_iterator_tag >
 Specialization of filter_iterator_base for bidirectional iteration. More...
 
struct  llvm::detail::fwd_or_bidi_tag_impl< is_bidirectional >
 
struct  llvm::detail::fwd_or_bidi_tag_impl< true >
 
struct  llvm::detail::fwd_or_bidi_tag< IterT >
 Helper which sets its type member to forward_iterator_tag if the category of IterT does not derive from bidirectional_iterator_tag, and to bidirectional_iterator_tag otherwise. More...
 
class  llvm::early_inc_iterator_impl< WrappedIteratorT >
 A pseudo-iterator adaptor that is designed to implement "early increment" style loops. More...
 
struct  llvm::index_sequence< I >
 Alias for the common case of a sequence of size_ts. More...
 
struct  llvm::index_sequence_for< Ts >
 Creates a compile-time integer sequence for a parameter pack. More...
 
struct  llvm::detail::ZipTupleType< Iters >
 
struct  llvm::detail::zip_common< ZipType, Iters >
 
struct  llvm::detail::zip_first< Iters >
 
class  llvm::detail::zip_shortest< Iters >
 
class  llvm::detail::zippy< ItType, Args >
 
struct  llvm::detail::ZipLongestItemType< Iter >
 
struct  llvm::detail::ZipLongestTupleType< Iters >
 
class  llvm::detail::zip_longest_iterator< Iters >
 
class  llvm::detail::zip_longest_range< Args >
 
class  llvm::concat_iterator< ValueT, IterTs >
 Iterator wrapper that concatenates sequences together. More...
 
class  llvm::detail::concat_range< ValueT, RangeTs >
 Helper to store a sequence of ranges being concatenated and access them. More...
 
struct  llvm::less_first
 Function object to check whether the first component of a std::pair compares less than the first component of another std::pair. More...
 
struct  llvm::less_second
 Function object to check whether the second component of a std::pair compares less than the second component of another std::pair. More...
 
struct  llvm::on_first< FuncTy >
 Function object to apply a binary function to the first component of a std::pair. More...
 
struct  llvm::integer_sequence< T, I >
 Represents a compile-time sequence of integers. More...
 
struct  llvm::index_sequence< I >
 Alias for the common case of a sequence of size_ts. More...
 
struct  llvm::build_index_impl< N, I >
 
struct  llvm::build_index_impl< 0, I... >
 
struct  llvm::index_sequence_for< Ts >
 Creates a compile-time integer sequence for a parameter pack. More...
 
struct  llvm::rank< N >
 Utility type to build an inheritance chain that makes it easy to rank overload candidates. More...
 
struct  llvm::rank< 0 >
 
struct  llvm::is_one_of< T, Ts >
 traits class for checking whether type T is one of any of the given types in the variadic list. More...
 
struct  llvm::is_one_of< T, U, Ts... >
 
struct  llvm::are_base_of< T, Ts >
 traits class for checking whether type T is a base class for all the given types in the variadic list. More...
 
struct  llvm::are_base_of< T, U, Ts... >
 
struct  llvm::FreeDeleter
 
struct  llvm::pair_hash< First, Second >
 
struct  llvm::less
 A functor like C++14's std::less<void> in its absence. More...
 
struct  llvm::equal
 A functor like C++14's std::equal<void> in its absence. More...
 
struct  llvm::deref< T >
 Binary functor that adapts to any other binary functor after dereferencing operands. More...
 
class  llvm::detail::enumerator_iter< R >
 
struct  llvm::detail::result_pair< R >
 
class  llvm::detail::enumerator_iter< R >
 
class  llvm::detail::enumerator< R >
 

Namespaces

 llvm
 This class represents lattice values for constants.
 
 llvm::detail
 Implementation details of the pass manager interfaces.
 
 llvm::adl_detail
 

Typedefs

template<typename RangeT >
using llvm::detail::IterOfRange = decltype(std::begin(std::declval< RangeT & >()))
 
template<typename RangeT >
using llvm::detail::ValueOfRange = typename std::remove_reference< decltype(*std::begin(std::declval< RangeT & >()))>::type
 
template<typename WrappedIteratorT , typename PredicateT >
using llvm::filter_iterator = filter_iterator_impl< WrappedIteratorT, PredicateT, typename detail::fwd_or_bidi_tag< WrappedIteratorT >::type >
 Defines filter_iterator to a suitable specialization of filter_iterator_impl, based on the underlying iterator's category. More...
 
template<typename ZipType , typename... Iters>
using llvm::detail::zip_traits = iterator_facade_base< ZipType, typename std::common_type< std::bidirectional_iterator_tag, typename std::iterator_traits< Iters >::iterator_category... >::type, typename ZipTupleType< Iters... >::type, typename std::iterator_traits< typename std::tuple_element< 0, std::tuple< Iters... > >::type >::difference_type, typename ZipTupleType< Iters... >::type *, typename ZipTupleType< Iters... >::type >
 

Functions

template<class T >
void llvm::deleter (T *Ptr)
 
template<typename ContainerTy >
auto llvm::adl_detail::adl_begin (ContainerTy &&container) -> decltype(begin(std::forward< ContainerTy >(container)))
 
template<typename ContainerTy >
auto llvm::adl_detail::adl_end (ContainerTy &&container) -> decltype(end(std::forward< ContainerTy >(container)))
 
template<typename T >
void llvm::adl_detail::adl_swap (T &&lhs, T &&rhs) noexcept(noexcept(swap(std::declval< T >(), std::declval< T >())))
 
template<typename ContainerTy >
auto llvm::adl_begin (ContainerTy &&container) -> decltype(adl_detail::adl_begin(std::forward< ContainerTy >(container)))
 
template<typename ContainerTy >
auto llvm::adl_end (ContainerTy &&container) -> decltype(adl_detail::adl_end(std::forward< ContainerTy >(container)))
 
template<typename T >
void llvm::adl_swap (T &&lhs, T &&rhs) noexcept(noexcept(adl_detail::adl_swap(std::declval< T >(), std::declval< T >())))
 
template<typename T >
constexpr bool llvm::empty (const T &RangeOrContainer)
 Test whether RangeOrContainer is empty. Similar to C++17 std::empty. More...
 
template<class ItTy , class FuncTy >
mapped_iterator< ItTy, FuncTy > llvm::map_iterator (ItTy I, FuncTy F)
 
template<typename ContainerTy >
auto llvm::reverse (ContainerTy &&C, typename std::enable_if< has_rbegin< ContainerTy >::value >::type *=nullptr) -> decltype(make_range(C.rbegin(), C.rend()))
 
template<typename IteratorTy >
std::reverse_iterator< IteratorTy > llvm::make_reverse_iterator (IteratorTy It)
 
template<typename ContainerTy >
auto llvm::reverse (ContainerTy &&C, typename std::enable_if<!has_rbegin< ContainerTy >::value >::type *=nullptr) -> decltype(make_range(llvm::make_reverse_iterator(std::end(C)), llvm::make_reverse_iterator(std::begin(C))))
 
template<typename RangeT , typename PredicateT >
iterator_range< filter_iterator< detail::IterOfRange< RangeT >, PredicateT > > llvm::make_filter_range (RangeT &&Range, PredicateT Pred)
 Convenience function that takes a range of elements and a predicate, and return a new filter_iterator range. More...
 
template<typename RangeT >
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > llvm::make_early_inc_range (RangeT &&Range)
 Make a range that does early increment to allow mutation of the underlying range without disrupting iteration. More...
 
template<typename R , typename UnaryPredicate >
bool llvm::all_of (R &&Range, UnaryPredicate P)
 Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly. More...
 
template<typename R , typename UnaryPredicate >
bool llvm::any_of (R &&Range, UnaryPredicate P)
 Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly. More...
 
template<typename T , typename U , typename... Args>
detail::zippy< detail::zip_shortest, T, U, Args... > llvm::zip (T &&t, U &&u, Args &&... args)
 zip iterator for two or more iteratable types. More...
 
template<typename T , typename U , typename... Args>
detail::zippy< detail::zip_first, T, U, Args... > llvm::zip_first (T &&t, U &&u, Args &&... args)
 zip iterator that, for the sake of efficiency, assumes the first iteratee to be the shortest. More...
 
template<typename Iter >
static Iter llvm::detail::next_or_end (const Iter &I, const Iter &End)
 
template<typename Iter >
static auto llvm::detail::deref_or_none (const Iter &I, const Iter &End) -> llvm::Optional< typename std::remove_const< typename std::remove_reference< decltype(*I)>::type >::type >
 
template<typename T , typename U , typename... Args>
detail::zip_longest_range< T, U, Args... > llvm::zip_longest (T &&t, U &&u, Args &&... args)
 Iterate over two or more iterators at the same time. More...
 
template<typename ValueT , typename... RangeTs>
detail::concat_range< ValueT, RangeTs... > llvm::concat (RangeTs &&... Ranges)
 Concatenated range across two or more ranges. More...
 
template<class T , std::size_t N>
constexpr size_t llvm::array_lengthof (T(&)[N])
 Find the length of an array. More...
 
template<typename T >
int llvm::array_pod_sort_comparator (const void *P1, const void *P2)
 Adapt std::less<T> for array_pod_sort. More...
 
template<class IteratorTy >
void llvm::array_pod_sort (IteratorTy Start, IteratorTy End)
 array_pod_sort - This sorts an array with the specified start and end extent. More...
 
template<class IteratorTy >
void llvm::array_pod_sort (IteratorTy Start, IteratorTy End, int(*Compare)(const typename std::iterator_traits< IteratorTy >::value_type *, const typename std::iterator_traits< IteratorTy >::value_type *))
 
template<typename IteratorTy >
void llvm::sort (IteratorTy Start, IteratorTy End)
 
template<typename Container >
void llvm::sort (Container &&C)
 
template<typename IteratorTy , typename Compare >
void llvm::sort (IteratorTy Start, IteratorTy End, Compare Comp)
 
template<typename Container , typename Compare >
void llvm::sort (Container &&C, Compare Comp)
 
template<typename Container >
void llvm::DeleteContainerPointers (Container &C)
 For a container of pointers, deletes the pointers and then clears the container. More...
 
template<typename Container >
void llvm::DeleteContainerSeconds (Container &C)
 In a container of pairs (usually a map) whose second element is a pointer, deletes the second elements and then clears the container. More...
 
template<typename R >
auto llvm::size (R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
 Get the size of a range. More...
 
template<typename R , typename UnaryPredicate >
UnaryPredicate llvm::for_each (R &&Range, UnaryPredicate P)
 Provide wrappers to std::for_each which take ranges instead of having to pass begin/end explicitly. More...
 
template<typename R , typename UnaryPredicate >
bool llvm::none_of (R &&Range, UnaryPredicate P)
 Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly. More...
 
template<typename R , typename T >
auto llvm::find (R &&Range, const T &Val) -> decltype(adl_begin(Range))
 Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly. More...
 
template<typename R , typename UnaryPredicate >
auto llvm::find_if (R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
 Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly. More...
 
template<typename R , typename UnaryPredicate >
auto llvm::find_if_not (R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
 
template<typename R , typename UnaryPredicate >
auto llvm::remove_if (R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
 Provide wrappers to std::remove_if which take ranges instead of having to pass begin/end explicitly. More...
 
template<typename R , typename OutputIt , typename UnaryPredicate >
OutputIt llvm::copy_if (R &&Range, OutputIt Out, UnaryPredicate P)
 Provide wrappers to std::copy_if which take ranges instead of having to pass begin/end explicitly. More...
 
template<typename R , typename OutputIt >
OutputIt llvm::copy (R &&Range, OutputIt Out)
 
template<typename R , typename E >
bool llvm::is_contained (R &&Range, const E &Element)
 Wrapper function around std::find to detect if an element exists in a container. More...
 
template<typename R , typename E >
auto llvm::count (R &&Range, const E &Element) -> typename std::iterator_traits< decltype(adl_begin(Range))>::difference_type
 Wrapper function around std::count to count the number of times an element Element occurs in the given range Range. More...
 
template<typename R , typename UnaryPredicate >
auto llvm::count_if (R &&Range, UnaryPredicate P) -> typename std::iterator_traits< decltype(adl_begin(Range))>::difference_type
 Wrapper function around std::count_if to count the number of times an element satisfying a given predicate occurs in a range. More...
 
template<typename R , typename OutputIt , typename UnaryPredicate >
OutputIt llvm::transform (R &&Range, OutputIt d_first, UnaryPredicate P)
 Wrapper function around std::transform to apply a function to a range and store the result elsewhere. More...
 
template<typename R , typename UnaryPredicate >
auto llvm::partition (R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
 Provide wrappers to std::partition which take ranges instead of having to pass begin/end explicitly. More...
 
template<typename R , typename ForwardIt >
auto llvm::lower_bound (R &&Range, ForwardIt I) -> decltype(adl_begin(Range))
 Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly. More...
 
template<typename R , typename ForwardIt , typename Compare >
auto llvm::lower_bound (R &&Range, ForwardIt I, Compare C) -> decltype(adl_begin(Range))
 
template<typename R , typename ForwardIt >
auto llvm::upper_bound (R &&Range, ForwardIt I) -> decltype(adl_begin(Range))
 Provide wrappers to std::upper_bound which take ranges instead of having to pass begin/end explicitly. More...
 
template<typename R , typename ForwardIt , typename Compare >
auto llvm::upper_bound (R &&Range, ForwardIt I, Compare C) -> decltype(adl_begin(Range))
 
template<typename R >
bool llvm::is_splat (R &&Range)
 Wrapper function around std::equal to detect if all elements in a container are same. More...
 
template<unsigned Size, typename R >
SmallVector< typename std::remove_const< detail::ValueOfRange< R > >::type, Sizellvm::to_vector (R &&Range)
 Given a range of type R, iterate the entire range and return a SmallVector with elements of the vector. More...
 
template<typename Container , typename UnaryPredicate >
void llvm::erase_if (Container &C, UnaryPredicate P)
 Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent to: More...
 
template<class T , class... Args>
std::enable_if<!std::is_array< T >::value, std::unique_ptr< T > >::type llvm::make_unique (Args &&... args)
 Constructs a new T() with the given args and returns a unique_ptr<T> which owns the object. More...
 
template<class T >
std::enable_if< std::is_array< T >::value &&std::extent< T >::value==0, std::unique_ptr< T > >::type llvm::make_unique (size_t n)
 Constructs a new T[n] with the given args and returns a unique_ptr<T[]> which owns the object. More...
 
template<class T , class... Args>
std::enable_if< std::extent< T >::value !=0 >::type llvm::make_unique (Args &&...)=delete
 This function isn't used and is only here to provide better compile errors. More...
 
template<typename R >
detail::enumerator< R > llvm::enumerate (R &&TheRange)
 Given an input range, returns a new range whose values are are pair (A,B) such that A is the 0-based index of the item in the sequence, and B is the value from the original sequence. More...
 
template<typename F , typename Tuple , std::size_t... I>
auto llvm::detail::apply_tuple_impl (F &&f, Tuple &&t, index_sequence< I... >) -> decltype(std::forward< F >(f)(std::get< I >(std::forward< Tuple >(t))...))
 
template<typename F , typename Tuple >
auto llvm::apply_tuple (F &&f, Tuple &&t) -> decltype(detail::apply_tuple_impl(std::forward< F >(f), std::forward< Tuple >(t), build_index_impl< std::tuple_size< typename std::decay< Tuple >::type >::value >
 Given an input tuple (a1, a2, ..., an), pass the arguments of the tuple variadically to f as if by calling f(a1, a2, ..., an) and return the result. More...
 
template<typename IterTy >
bool llvm::hasNItems (IterTy &&Begin, IterTy &&End, unsigned N, typename std::enable_if< !std::is_same< typename std::iterator_traits< typename std::remove_reference< decltype(Begin)>::type >::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr)
 Return true if the sequence [Begin, End) has exactly N items. More...
 
template<typename IterTy >
bool llvm::hasNItemsOrMore (IterTy &&Begin, IterTy &&End, unsigned N, typename std::enable_if< !std::is_same< typename std::iterator_traits< typename std::remove_reference< decltype(Begin)>::type >::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr)
 Return true if the sequence [Begin, End) has N or more items. More...
 

Variables

template<typename T >
int(*)(const void *, const void *) llvm::get_array_pod_sort_comparator (const T &)
 get_array_pod_sort_comparator - This is an internal helper function used to get type deduction of T right. More...