LLVM 19.0.0git
Classes | Namespaces | Typedefs | Functions | Variables
STLExtras.h File Reference

This file contains some templates that are useful if you are working with the STL at all. More...

#include "llvm/ADT/ADL.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/STLForwardCompat.h"
#include "llvm/ADT/STLFunctionalExtras.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 <optional>
#include <tuple>
#include <type_traits>
#include <utility>

Go to the source code of this file.

Classes

struct  llvm::make_const_ptr< T >
 
struct  llvm::make_const_ref< T >
 
struct  llvm::detail::detector< class, Op, Args >
 
struct  llvm::detail::detector< std::void_t< Op< Args... > >, Op, Args... >
 
struct  llvm::function_traits< T, isClass >
 This class provides various trait information about a callable object. More...
 
struct  llvm::function_traits< ReturnType(ClassType::*)(Args...) const, false >
 Overload for class function types. More...
 
struct  llvm::function_traits< ReturnType(ClassType::*)(Args...), false >
 Overload for class function types. More...
 
struct  llvm::function_traits< ReturnType(*)(Args...), false >
 Overload for non-class function types. More...
 
struct  llvm::function_traits< ReturnType(*const)(Args...), false >
 
struct  llvm::function_traits< ReturnType(&)(Args...), false >
 Overload for non-class function type references. More...
 
struct  llvm::detail::TypesAreDistinct< T, Us >
 
struct  llvm::detail::TypesAreDistinct< T >
 
struct  llvm::TypesAreDistinct<>
 
struct  llvm::TypesAreDistinct< Ts >
 Determine if all types in Ts are distinct. More...
 
struct  llvm::FirstIndexOfType< T, U, Us... >
 
struct  llvm::FirstIndexOfType< T, T, Us... >
 
class  llvm::callable_detail::Callable< T, bool >
 Templated storage wrapper for a callable. More...
 
class  llvm::callable_detail::Callable< T, true >
 
class  llvm::mapped_iterator< ItTy, FuncTy, ReferenceTy >
 
class  llvm::mapped_iterator_base< DerivedT, ItTy, ReferenceTy >
 A base type of mapped iterator, that is useful for building derived iterators that do not need/want to store the map function (as in mapped_iterator). More...
 
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::detail::ZipTupleType< Iters >
 
struct  llvm::detail::zip_common< ZipType, ReferenceTupleType, Iters >
 
struct  llvm::detail::zip_first< Iters >
 
struct  llvm::detail::zip_shortest< Iters >
 
struct  llvm::detail::ZippyIteratorTuple< ItType, std::tuple< Args... >, std::index_sequence< Ns... > >
 Partial specialization for non-const tuple storage. More...
 
struct  llvm::detail::ZippyIteratorTuple< ItType, const std::tuple< Args... >, std::index_sequence< Ns... > >
 Partial specialization for const tuple storage. More...
 
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...
 
class  llvm::indexed_accessor_iterator< DerivedT, BaseT, T, PointerT, ReferenceT >
 A utility class used to implement an iterator that contains some base object and an index. More...
 
class  llvm::detail::indexed_accessor_range_base< DerivedT, BaseT, T, PointerT, ReferenceT >
 The class represents the base of a range of indexed_accessor_iterators. More...
 
class  llvm::detail::indexed_accessor_range_base< DerivedT, BaseT, T, PointerT, ReferenceT >::iterator
 An iterator element of this range. More...
 
class  llvm::indexed_accessor_range< DerivedT, BaseT, T, PointerT, ReferenceT >
 This class provides an implementation of a range of indexed_accessor_iterators where the base is not indexable. More...
 
class  llvm::detail::first_or_second_type< EltTy, FirstTy >
 Return a reference to the first or second member of a reference. More...
 
struct  llvm::less_first
 Function object to check whether the first component of a container supported by std::get (like std::pair and std::tuple) compares less than the first component of another container. More...
 
struct  llvm::less_second
 Function object to check whether the second component of a container supported by std::get (like std::pair and std::tuple) compares less than the second component of another container. More...
 
struct  llvm::on_first< FuncTy >
 Function object to apply a binary function to the first component of a std::pair. 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::detail::Visitor< HeadT, TailTs... >
 
struct  llvm::detail::Visitor< HeadT >
 
struct  llvm::FreeDeleter
 
struct  llvm::pair_hash< First, Second >
 
struct  llvm::deref< T >
 Binary functor that adapts to any other binary functor after dereferencing operands. More...
 
struct  llvm::detail::zip_enumerator< Iters >
 Zippy iterator that uses the second iterator for comparisons. More...
 
struct  llvm::detail::enumerator_result< std::size_t, Refs... >
 
struct  llvm::detail::index_iterator
 
struct  llvm::detail::index_stream
 Infinite stream of increasing 0-based size_t indices. More...
 
class  llvm::index_range
 Increasing range of size_t indices. More...
 
struct  std::tuple_size< llvm::detail::enumerator_result< Refs... > >
 
struct  std::tuple_element< I, llvm::detail::enumerator_result< Refs... > >
 
struct  std::tuple_element< I, const llvm::detail::enumerator_result< Refs... > >
 

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
 
namespace  llvm::detail
 These are wrappers over isa* function that allow them to be used in generic algorithms such as llvm:all_of, llvm::none_of, etc.
 
namespace  llvm::callable_detail
 
namespace  std
 Implement std::hash so that hash_code can be used in STL containers.
 

Typedefs

template<template< class... > class Op, class... Args>
using llvm::is_detected = typename detail::detector< void, Op, Args... >::value_t
 Detects if a given trait holds for some set of arguments 'Args'.
 
template<typename T , typename... Ts>
using llvm::is_one_of = std::disjunction< std::is_same< T, Ts >... >
 traits class for checking whether type T is one of any of the given types in the variadic list.
 
template<typename T , typename... Ts>
using llvm::are_base_of = std::conjunction< std::is_base_of< T, Ts >... >
 traits class for checking whether type T is a base class for all the given types in the variadic list.
 
template<size_t I, typename... Ts>
using llvm::TypeAtIndex = std::tuple_element_t< I, std::tuple< Ts... > >
 Find the type at a given index in a list of types.
 
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.
 
template<typename ZipType , typename ReferenceTupleType , typename... Iters>
using llvm::detail::zip_traits = iterator_facade_base< ZipType, std::common_type_t< std::bidirectional_iterator_tag, typename std::iterator_traits< Iters >::iterator_category... >, ReferenceTupleType, typename std::iterator_traits< std::tuple_element_t< 0, std::tuple< Iters... > > >::difference_type, ReferenceTupleType *, ReferenceTupleType >
 
template<typename T >
using llvm::detail::sort_trivially_copyable = std::conjunction< std::is_pointer< T >, std::is_trivially_copyable< typename std::iterator_traits< T >::value_type > >
 
template<typename Range >
using llvm::detail::check_has_free_function_size = decltype(adl_size(std::declval< Range & >()))
 
template<typename Range , typename Element >
using llvm::detail::check_has_member_contains_t = decltype(std::declval< Range & >().contains(std::declval< const Element & >()))
 
template<typename Range , typename Element >
using llvm::detail::check_has_member_find_t = decltype(std::declval< Range & >().find(std::declval< const Element & >()) !=std::declval< Range & >().end())
 
template<typename... Iters>
using llvm::detail::EnumeratorTupleType = enumerator_result< decltype(*declval< Iters >())... >
 
template<typename T >
using llvm::detail::has_sizeof = decltype(sizeof(T))
 

Functions

template<typename EnumTy1 , typename EnumTy2 , typename UT1 = std::enable_if_t<std::is_enum<EnumTy1>::value, std::underlying_type_t<EnumTy1>>, typename UT2 = std::enable_if_t<std::is_enum<EnumTy2>::value, std::underlying_type_t<EnumTy2>>>
constexpr auto llvm::addEnumValues (EnumTy1 LHS, EnumTy2 RHS)
 Helper which adds two underlying types of enumeration type.
 
template<typename ContainerTy >
bool llvm::hasSingleElement (ContainerTy &&C)
 Returns true if the given container only contains a single element.
 
template<typename T >
auto llvm::drop_begin (T &&RangeOrContainer, size_t N=1)
 Return a range covering RangeOrContainer with the first N elements excluded.
 
template<typename T >
auto llvm::drop_end (T &&RangeOrContainer, size_t N=1)
 Return a range covering RangeOrContainer with the last N elements excluded.
 
template<class ItTy , class FuncTy >
mapped_iterator< ItTy, FuncTy > llvm::map_iterator (ItTy I, FuncTy F)
 
template<class ContainerTy , class FuncTy >
auto llvm::map_range (ContainerTy &&C, FuncTy F)
 
template<typename ContainerTy >
auto llvm::reverse (ContainerTy &&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.
 
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.
 
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.
 
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.
 
template<typename T >
bool llvm::all_equal (std::initializer_list< T > Values)
 Returns true if all Values in the initializer lists are equal or the list.
 
template<typename R >
constexpr size_t llvm::range_size (R &&Range)
 Returns the size of the Range, i.e., the number of elements.
 
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.
 
template<typename T , typename U , typename... Args>
detail::zippy< detail::zip_first, T, U, Args... > llvm::zip_equal (T &&t, U &&u, Args &&...args)
 zip iterator that assumes that all iteratees have the same length.
 
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.
 
template<typename Iter >
Iter llvm::detail::next_or_end (const Iter &I, const Iter &End)
 
template<typename Iter >
auto llvm::detail::deref_or_none (const Iter &I, const Iter &End) -> std::optional< std::remove_const_t< std::remove_reference_t< decltype(*I)> > >
 
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.
 
template<typename ValueT , typename... RangeTs>
detail::concat_range< ValueT, RangeTs... > llvm::concat (RangeTs &&... Ranges)
 Concatenated range across two or more ranges.
 
template<typename OtherT , typename DerivedT , typename BaseT , typename T , typename PointerT , typename ReferenceT >
bool llvm::detail::operator== (const indexed_accessor_range_base< DerivedT, BaseT, T, PointerT, ReferenceT > &lhs, const OtherT &rhs)
 Compare this range with another.
 
template<typename OtherT , typename DerivedT , typename BaseT , typename T , typename PointerT , typename ReferenceT >
bool llvm::detail::operator!= (const indexed_accessor_range_base< DerivedT, BaseT, T, PointerT, ReferenceT > &lhs, const OtherT &rhs)
 
template<typename ContainerTy >
auto llvm::make_first_range (ContainerTy &&c)
 Given a container of pairs, return a range over the first elements.
 
template<typename ContainerTy >
auto llvm::make_second_range (ContainerTy &&c)
 Given a container of pairs, return a range over the second elements.
 
template<typename... CallableTs>
constexpr decltype(auto) llvm::makeVisitor (CallableTs &&...Callables)
 Returns an opaquely-typed Callable object whose operator() overload set is the sum of the operator() overload sets of each CallableT in CallableTs.
 
template<class Iterator , class RNG >
void llvm::shuffle (Iterator first, Iterator last, RNG &&g)
 
template<typename T >
int llvm::array_pod_sort_comparator (const void *P1, const void *P2)
 Adapt std::less<T> for array_pod_sort.
 
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.
 
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 R >
auto llvm::size (R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
 Get the size of a range.
 
template<typename R , typename UnaryFunction >
UnaryFunction llvm::for_each (R &&Range, UnaryFunction F)
 Provide wrappers to std::for_each which take ranges instead of having to pass begin/end explicitly.
 
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.
 
template<typename R , typename T >
auto llvm::find (R &&Range, const T &Val)
 Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
 
template<typename R , typename UnaryPredicate >
auto llvm::find_if (R &&Range, UnaryPredicate P)
 Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
 
template<typename R , typename UnaryPredicate >
auto llvm::find_if_not (R &&Range, UnaryPredicate P)
 
template<typename R , typename UnaryPredicate >
auto llvm::remove_if (R &&Range, UnaryPredicate P)
 Provide wrappers to std::remove_if which take ranges instead of having to pass begin/end explicitly.
 
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.
 
template<typename T , typename R , typename Predicate >
Tllvm::find_singleton (R &&Range, Predicate P, bool AllowRepeats=false)
 Return the single value in Range that satisfies P(<member of Range> *, AllowRepeats)->T * returning nullptr when no values or multiple values were found.
 
template<typename T , typename R , typename Predicate >
std::pair< T *, boolllvm::find_singleton_nested (R &&Range, Predicate P, bool AllowRepeats=false)
 Return a pair consisting of the single value in Range that satisfies P(<member of Range> *, AllowRepeats)->std::pair<T*, bool> returning nullptr when no values or multiple values were found, and a bool indicating whether multiple values were found to cause the nullptr.
 
template<typename R , typename OutputIt >
OutputIt llvm::copy (R &&Range, OutputIt Out)
 
template<typename R , typename OutputIt , typename UnaryPredicate , typename T >
OutputIt llvm::replace_copy_if (R &&Range, OutputIt Out, UnaryPredicate P, const T &NewValue)
 Provide wrappers to std::replace_copy_if which take ranges instead of having to pass begin/end explicitly.
 
template<typename R , typename OutputIt , typename T >
OutputIt llvm::replace_copy (R &&Range, OutputIt Out, const T &OldValue, const T &NewValue)
 Provide wrappers to std::replace_copy which take ranges instead of having to pass begin/end explicitly.
 
template<typename R , typename OutputIt >
OutputIt llvm::move (R &&Range, OutputIt Out)
 Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
 
template<typename R , typename E >
bool llvm::is_contained (R &&Range, const E &Element)
 Returns true if Element is found in Range.
 
template<typename T , typename E >
constexpr bool llvm::is_contained (std::initializer_list< T > Set, const E &Element)
 Returns true iff Element exists in Set.
 
template<typename R , typename Compare >
bool llvm::is_sorted (R &&Range, Compare C)
 Wrapper function around std::is_sorted to check if elements in a range R are sorted with respect to a comparator C.
 
template<typename R >
bool llvm::is_sorted (R &&Range)
 Wrapper function around std::is_sorted to check if elements in a range R are sorted in non-descending order.
 
template<typename R , typename E >
auto llvm::count (R &&Range, const E &Element)
 Wrapper function around std::count to count the number of times an element Element occurs in the given range Range.
 
template<typename R , typename UnaryPredicate >
auto llvm::count_if (R &&Range, UnaryPredicate P)
 Wrapper function around std::count_if to count the number of times an element satisfying a given predicate occurs in a range.
 
template<typename R , typename OutputIt , typename UnaryFunction >
OutputIt llvm::transform (R &&Range, OutputIt d_first, UnaryFunction F)
 Wrapper function around std::transform to apply a function to a range and store the result elsewhere.
 
template<typename R , typename UnaryPredicate >
auto llvm::partition (R &&Range, UnaryPredicate P)
 Provide wrappers to std::partition which take ranges instead of having to pass begin/end explicitly.
 
template<typename R , typename T >
auto llvm::binary_search (R &&Range, T &&Value)
 Provide wrappers to std::binary_search which take ranges instead of having to pass begin/end explicitly.
 
template<typename R , typename T , typename Compare >
auto llvm::binary_search (R &&Range, T &&Value, Compare C)
 
template<typename R , typename T >
auto llvm::lower_bound (R &&Range, T &&Value)
 Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly.
 
template<typename R , typename T , typename Compare >
auto llvm::lower_bound (R &&Range, T &&Value, Compare C)
 
template<typename R , typename T >
auto llvm::upper_bound (R &&Range, T &&Value)
 Provide wrappers to std::upper_bound which take ranges instead of having to pass begin/end explicitly.
 
template<typename R , typename T , typename Compare >
auto llvm::upper_bound (R &&Range, T &&Value, Compare C)
 
template<typename R >
auto llvm::min_element (R &&Range)
 
template<typename R , typename Compare >
auto llvm::min_element (R &&Range, Compare C)
 
template<typename R >
auto llvm::max_element (R &&Range)
 
template<typename R , typename Compare >
auto llvm::max_element (R &&Range, Compare C)
 
template<typename R >
void llvm::stable_sort (R &&Range)
 
template<typename R , typename Compare >
void llvm::stable_sort (R &&Range, Compare C)
 
template<typename R , typename Predicate , typename Val = decltype(*adl_begin(std::declval<R>()))>
auto llvm::partition_point (R &&Range, Predicate P)
 Binary search for the first iterator in a range where a predicate is false.
 
template<typename Range , typename Predicate >
auto llvm::unique (Range &&R, Predicate P)
 
template<typename Range >
auto llvm::unique (Range &&R)
 Wrapper function around std::unique to allow calling unique on a container without having to specify the begin/end iterators.
 
template<typename L , typename R >
bool llvm::equal (L &&LRange, R &&RRange)
 Wrapper function around std::equal to detect if pair-wise elements between two ranges are the same.
 
template<typename R >
bool llvm::all_equal (R &&Range)
 Returns true if all elements in Range are equal or when the Range is empty.
 
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:
 
template<typename Container , typename ValueType >
void llvm::erase (Container &C, ValueType V)
 Wrapper function to remove a value from a container:
 
template<typename Container , typename ValueType >
void llvm::erase_value (Container &C, ValueType V)
 
template<typename Container , typename Range >
void llvm::append_range (Container &C, Range &&R)
 Wrapper function to append range R to container C.
 
template<typename Container , typename... Args>
void llvm::append_values (Container &C, Args &&...Values)
 Appends all Values to container C.
 
template<typename Container , typename RandomAccessIterator >
void llvm::replace (Container &Cont, typename Container::iterator ContIt, typename Container::iterator ContEnd, RandomAccessIterator ValIt, RandomAccessIterator ValEnd)
 Given a sequence container Cont, replace the range [ContIt, ContEnd) with the range [ValIt, ValEnd) (which is not from the same container).
 
template<typename Container , typename Range = std::initializer_list< typename Container::value_type>>
void llvm::replace (Container &Cont, typename Container::iterator ContIt, typename Container::iterator ContEnd, Range R)
 Given a sequence container Cont, replace the range [ContIt, ContEnd) with the range R.
 
template<typename ForwardIterator , typename UnaryFunctor , typename NullaryFunctor , typename = std::enable_if_t< !std::is_constructible<StringRef, UnaryFunctor>::value && !std::is_constructible<StringRef, NullaryFunctor>::value>>
void llvm::interleave (ForwardIterator begin, ForwardIterator end, UnaryFunctor each_fn, NullaryFunctor between_fn)
 An STL-style algorithm similar to std::for_each that applies a second functor between every pair of elements.
 
template<typename Container , typename UnaryFunctor , typename NullaryFunctor , typename = std::enable_if_t< !std::is_constructible<StringRef, UnaryFunctor>::value && !std::is_constructible<StringRef, NullaryFunctor>::value>>
void llvm::interleave (const Container &c, UnaryFunctor each_fn, NullaryFunctor between_fn)
 
template<typename Container , typename UnaryFunctor , typename StreamT , typename T = detail::ValueOfRange<Container>>
void llvm::interleave (const Container &c, StreamT &os, UnaryFunctor each_fn, const StringRef &separator)
 Overload of interleave for the common case of string separator.
 
template<typename Container , typename StreamT , typename T = detail::ValueOfRange<Container>>
void llvm::interleave (const Container &c, StreamT &os, const StringRef &separator)
 
template<typename Container , typename UnaryFunctor , typename StreamT , typename T = detail::ValueOfRange<Container>>
void llvm::interleaveComma (const Container &c, StreamT &os, UnaryFunctor each_fn)
 
template<typename Container , typename StreamT , typename T = detail::ValueOfRange<Container>>
void llvm::interleaveComma (const Container &c, StreamT &os)
 
template<typename FirstRange , typename... RestRanges>
auto llvm::enumerate (FirstRange &&First, RestRanges &&...Rest)
 Given two or more input ranges, returns a new range whose values are are tuples (A, B, C, ...), such that A is the 0-based index of the item in the sequence, and B, C, ..., are the values from the original input ranges.
 
template<typename Predicate , typename... Args>
bool llvm::detail::all_of_zip_predicate_first (Predicate &&P, Args &&...args)
 
template<typename... ArgsThenPredicate, size_t... InputIndexes>
bool llvm::detail::all_of_zip_predicate_last (std::tuple< ArgsThenPredicate... > argsThenPredicate, std::index_sequence< InputIndexes... >)
 
template<typename... ArgsAndPredicate>
bool llvm::all_of_zip (ArgsAndPredicate &&...argsAndPredicate)
 Compare two zipped ranges using the provided predicate (as last argument).
 
template<typename IterTy , typename Pred = bool (*)(const decltype(*std::declval<IterTy>()) &)>
bool llvm::hasNItems (IterTy &&Begin, IterTy &&End, unsigned N, Pred &&ShouldBeCounted=[](const decltype(*std::declval< IterTy >()) &) { return true;}, std::enable_if_t< !std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< std::remove_reference_t< decltype(Begin)> >::iterator_category >::value, void > *=nullptr)
 Return true if the sequence [Begin, End) has exactly N items.
 
template<typename IterTy , typename Pred = bool (*)(const decltype(*std::declval<IterTy>()) &)>
bool llvm::hasNItemsOrMore (IterTy &&Begin, IterTy &&End, unsigned N, Pred &&ShouldBeCounted=[](const decltype(*std::declval< IterTy >()) &) { return true;}, std::enable_if_t< !std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< std::remove_reference_t< decltype(Begin)> >::iterator_category >::value, void > *=nullptr)
 Return true if the sequence [Begin, End) has N or more items.
 
template<typename IterTy , typename Pred = bool (*)(const decltype(*std::declval<IterTy>()) &)>
bool llvm::hasNItemsOrLess (IterTy &&Begin, IterTy &&End, unsigned N, Pred &&ShouldBeCounted=[](const decltype(*std::declval< IterTy >()) &) { return true;})
 Returns true if the sequence [Begin, End) has N or less items.
 
template<typename ContainerTy >
bool llvm::hasNItems (ContainerTy &&C, unsigned N)
 Returns true if the given container has exactly N items.
 
template<typename ContainerTy >
bool llvm::hasNItemsOrMore (ContainerTy &&C, unsigned N)
 Returns true if the given container has N or more items.
 
template<typename ContainerTy >
bool llvm::hasNItemsOrLess (ContainerTy &&C, unsigned N)
 Returns true if the given container has N or less items.
 
template<class Ptr >
auto llvm::to_address (const Ptr &P)
 Returns a raw pointer that represents the same address as the argument.
 
template<class T >
constexpr Tllvm::to_address (T *P)
 

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.
 
template<typename Range >
static constexpr bool llvm::detail::HasFreeFunctionSize
 
template<typename Range , typename Element >
static constexpr bool llvm::detail::HasMemberContains
 
template<typename Range , typename Element >
static constexpr bool llvm::detail::HasMemberFind
 
template<typename T >
constexpr bool llvm::is_incomplete_v = !is_detected<detail::has_sizeof, T>::value
 Detects when type T is incomplete.
 

Detailed Description

This file contains some templates that are useful if you are working with the STL at all.

No library is required when using these functions.

Definition in file STLExtras.h.