2014-04-24 05:31:23 +02:00
|
|
|
//===- iterator.h - Utilities for using and defining iterators --*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 09:50:56 +01:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2014-04-24 05:31:23 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_ADT_ITERATOR_H
|
|
|
|
#define LLVM_ADT_ITERATOR_H
|
|
|
|
|
2017-03-27 14:56:12 +02:00
|
|
|
#include "llvm/ADT/iterator_range.h"
|
2014-04-27 00:59:28 +02:00
|
|
|
#include <cstddef>
|
2015-01-14 12:23:27 +01:00
|
|
|
#include <iterator>
|
2016-11-23 01:30:24 +01:00
|
|
|
#include <type_traits>
|
2017-06-14 00:11:49 +02:00
|
|
|
#include <utility>
|
2014-04-24 05:31:23 +02:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
2018-05-01 17:54:18 +02:00
|
|
|
/// CRTP base class which implements the entire standard iterator facade
|
2014-04-24 06:07:06 +02:00
|
|
|
/// in terms of a minimal subset of the interface.
|
|
|
|
///
|
|
|
|
/// Use this when it is reasonable to implement most of the iterator
|
|
|
|
/// functionality in terms of a core subset. If you need special behavior or
|
|
|
|
/// there are performance implications for this, you may want to override the
|
|
|
|
/// relevant members instead.
|
|
|
|
///
|
|
|
|
/// Note, one abstraction that this does *not* provide is implementing
|
|
|
|
/// subtraction in terms of addition by negating the difference. Negation isn't
|
|
|
|
/// always information preserving, and I can see very reasonable iterator
|
|
|
|
/// designs where this doesn't work well. It doesn't really force much added
|
|
|
|
/// boilerplate anyways.
|
|
|
|
///
|
|
|
|
/// Another abstraction that this doesn't provide is implementing increment in
|
|
|
|
/// terms of addition of one. These aren't equivalent for all iterator
|
|
|
|
/// categories, and respecting that adds a lot of complexity for little gain.
|
2017-01-11 01:34:41 +01:00
|
|
|
///
|
|
|
|
/// Classes wishing to use `iterator_facade_base` should implement the following
|
|
|
|
/// methods:
|
|
|
|
///
|
|
|
|
/// Forward Iterators:
|
|
|
|
/// (All of the following methods)
|
|
|
|
/// - DerivedT &operator=(const DerivedT &R);
|
|
|
|
/// - bool operator==(const DerivedT &R) const;
|
|
|
|
/// - const T &operator*() const;
|
|
|
|
/// - T &operator*();
|
|
|
|
/// - DerivedT &operator++();
|
|
|
|
///
|
|
|
|
/// Bidirectional Iterators:
|
|
|
|
/// (All methods of forward iterators, plus the following)
|
|
|
|
/// - DerivedT &operator--();
|
|
|
|
///
|
|
|
|
/// Random-access Iterators:
|
|
|
|
/// (All methods of bidirectional iterators excluding the following)
|
|
|
|
/// - DerivedT &operator++();
|
|
|
|
/// - DerivedT &operator--();
|
|
|
|
/// (and plus the following)
|
|
|
|
/// - bool operator<(const DerivedT &RHS) const;
|
|
|
|
/// - DifferenceTypeT operator-(const DerivedT &R) const;
|
|
|
|
/// - DerivedT &operator+=(DifferenceTypeT N);
|
|
|
|
/// - DerivedT &operator-=(DifferenceTypeT N);
|
|
|
|
///
|
2014-04-24 06:07:06 +02:00
|
|
|
template <typename DerivedT, typename IteratorCategoryT, typename T,
|
2014-04-27 00:59:28 +02:00
|
|
|
typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *,
|
2014-04-24 06:07:06 +02:00
|
|
|
typename ReferenceT = T &>
|
2021-04-12 19:47:14 +02:00
|
|
|
class iterator_facade_base {
|
|
|
|
public:
|
|
|
|
using iterator_category = IteratorCategoryT;
|
|
|
|
using value_type = T;
|
|
|
|
using difference_type = DifferenceTypeT;
|
|
|
|
using pointer = PointerT;
|
|
|
|
using reference = ReferenceT;
|
|
|
|
|
2014-04-30 02:49:32 +02:00
|
|
|
protected:
|
|
|
|
enum {
|
2017-09-30 00:46:22 +02:00
|
|
|
IsRandomAccess = std::is_base_of<std::random_access_iterator_tag,
|
|
|
|
IteratorCategoryT>::value,
|
|
|
|
IsBidirectional = std::is_base_of<std::bidirectional_iterator_tag,
|
|
|
|
IteratorCategoryT>::value,
|
2014-04-30 02:49:32 +02:00
|
|
|
};
|
|
|
|
|
2016-05-13 05:57:50 +02:00
|
|
|
/// A proxy object for computing a reference via indirecting a copy of an
|
|
|
|
/// iterator. This is used in APIs which need to produce a reference via
|
|
|
|
/// indirection but for which the iterator object might be a temporary. The
|
|
|
|
/// proxy preserves the iterator internally and exposes the indirected
|
|
|
|
/// reference via a conversion operator.
|
|
|
|
class ReferenceProxy {
|
|
|
|
friend iterator_facade_base;
|
|
|
|
|
|
|
|
DerivedT I;
|
|
|
|
|
|
|
|
ReferenceProxy(DerivedT I) : I(std::move(I)) {}
|
|
|
|
|
|
|
|
public:
|
|
|
|
operator ReferenceT() const { return *I; }
|
|
|
|
};
|
|
|
|
|
2014-04-30 02:49:32 +02:00
|
|
|
public:
|
2014-04-24 06:07:06 +02:00
|
|
|
DerivedT operator+(DifferenceTypeT n) const {
|
2017-02-07 04:15:12 +01:00
|
|
|
static_assert(std::is_base_of<iterator_facade_base, DerivedT>::value,
|
|
|
|
"Must pass the derived type to this template!");
|
2014-04-30 02:49:32 +02:00
|
|
|
static_assert(
|
|
|
|
IsRandomAccess,
|
|
|
|
"The '+' operator is only defined for random access iterators.");
|
2014-04-24 06:07:06 +02:00
|
|
|
DerivedT tmp = *static_cast<const DerivedT *>(this);
|
|
|
|
tmp += n;
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
friend DerivedT operator+(DifferenceTypeT n, const DerivedT &i) {
|
2014-04-30 02:49:32 +02:00
|
|
|
static_assert(
|
|
|
|
IsRandomAccess,
|
|
|
|
"The '+' operator is only defined for random access iterators.");
|
2014-04-24 06:07:06 +02:00
|
|
|
return i + n;
|
|
|
|
}
|
|
|
|
DerivedT operator-(DifferenceTypeT n) const {
|
2014-04-30 02:49:32 +02:00
|
|
|
static_assert(
|
|
|
|
IsRandomAccess,
|
|
|
|
"The '-' operator is only defined for random access iterators.");
|
2014-04-24 06:07:06 +02:00
|
|
|
DerivedT tmp = *static_cast<const DerivedT *>(this);
|
|
|
|
tmp -= n;
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
DerivedT &operator++() {
|
2017-02-07 04:15:12 +01:00
|
|
|
static_assert(std::is_base_of<iterator_facade_base, DerivedT>::value,
|
|
|
|
"Must pass the derived type to this template!");
|
2014-04-24 06:07:06 +02:00
|
|
|
return static_cast<DerivedT *>(this)->operator+=(1);
|
|
|
|
}
|
|
|
|
DerivedT operator++(int) {
|
|
|
|
DerivedT tmp = *static_cast<DerivedT *>(this);
|
|
|
|
++*static_cast<DerivedT *>(this);
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
DerivedT &operator--() {
|
2014-04-30 02:49:32 +02:00
|
|
|
static_assert(
|
|
|
|
IsBidirectional,
|
|
|
|
"The decrement operator is only defined for bidirectional iterators.");
|
2014-04-24 06:07:06 +02:00
|
|
|
return static_cast<DerivedT *>(this)->operator-=(1);
|
|
|
|
}
|
|
|
|
DerivedT operator--(int) {
|
2014-04-30 02:49:32 +02:00
|
|
|
static_assert(
|
|
|
|
IsBidirectional,
|
|
|
|
"The decrement operator is only defined for bidirectional iterators.");
|
2014-04-24 06:07:06 +02:00
|
|
|
DerivedT tmp = *static_cast<DerivedT *>(this);
|
|
|
|
--*static_cast<DerivedT *>(this);
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
2020-12-17 11:41:35 +01:00
|
|
|
#ifndef __cpp_impl_three_way_comparison
|
2014-04-24 06:07:06 +02:00
|
|
|
bool operator!=(const DerivedT &RHS) const {
|
2020-12-17 11:41:35 +01:00
|
|
|
return !(static_cast<const DerivedT &>(*this) == RHS);
|
2014-04-24 06:07:06 +02:00
|
|
|
}
|
2020-12-17 11:41:35 +01:00
|
|
|
#endif
|
2014-04-24 06:07:06 +02:00
|
|
|
|
|
|
|
bool operator>(const DerivedT &RHS) const {
|
2014-04-30 02:49:32 +02:00
|
|
|
static_assert(
|
|
|
|
IsRandomAccess,
|
|
|
|
"Relational operators are only defined for random access iterators.");
|
2020-12-17 11:41:35 +01:00
|
|
|
return !(static_cast<const DerivedT &>(*this) < RHS) &&
|
|
|
|
!(static_cast<const DerivedT &>(*this) == RHS);
|
2014-04-24 06:07:06 +02:00
|
|
|
}
|
|
|
|
bool operator<=(const DerivedT &RHS) const {
|
2014-04-30 02:49:32 +02:00
|
|
|
static_assert(
|
|
|
|
IsRandomAccess,
|
|
|
|
"Relational operators are only defined for random access iterators.");
|
2020-12-17 11:41:35 +01:00
|
|
|
return !(static_cast<const DerivedT &>(*this) > RHS);
|
2014-04-24 06:07:06 +02:00
|
|
|
}
|
|
|
|
bool operator>=(const DerivedT &RHS) const {
|
2014-04-30 02:49:32 +02:00
|
|
|
static_assert(
|
|
|
|
IsRandomAccess,
|
|
|
|
"Relational operators are only defined for random access iterators.");
|
2020-12-17 11:41:35 +01:00
|
|
|
return !(static_cast<const DerivedT &>(*this) < RHS);
|
2014-04-24 06:07:06 +02:00
|
|
|
}
|
|
|
|
|
2017-04-12 09:27:28 +02:00
|
|
|
PointerT operator->() { return &static_cast<DerivedT *>(this)->operator*(); }
|
2014-04-24 06:07:06 +02:00
|
|
|
PointerT operator->() const {
|
|
|
|
return &static_cast<const DerivedT *>(this)->operator*();
|
|
|
|
}
|
2017-04-12 09:27:28 +02:00
|
|
|
ReferenceProxy operator[](DifferenceTypeT n) {
|
|
|
|
static_assert(IsRandomAccess,
|
|
|
|
"Subscripting is only defined for random access iterators.");
|
|
|
|
return ReferenceProxy(static_cast<DerivedT *>(this)->operator+(n));
|
|
|
|
}
|
2016-05-13 05:57:50 +02:00
|
|
|
ReferenceProxy operator[](DifferenceTypeT n) const {
|
2014-04-30 02:49:32 +02:00
|
|
|
static_assert(IsRandomAccess,
|
|
|
|
"Subscripting is only defined for random access iterators.");
|
2016-05-13 05:57:50 +02:00
|
|
|
return ReferenceProxy(static_cast<const DerivedT *>(this)->operator+(n));
|
2014-04-24 06:07:06 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-05-01 17:54:18 +02:00
|
|
|
/// CRTP base class for adapting an iterator to a different type.
|
2014-04-24 05:31:23 +02:00
|
|
|
///
|
|
|
|
/// This class can be used through CRTP to adapt one iterator into another.
|
|
|
|
/// Typically this is done through providing in the derived class a custom \c
|
|
|
|
/// operator* implementation. Other methods can be overridden as well.
|
2014-04-29 03:57:35 +02:00
|
|
|
template <
|
|
|
|
typename DerivedT, typename WrappedIteratorT,
|
|
|
|
typename IteratorCategoryT =
|
|
|
|
typename std::iterator_traits<WrappedIteratorT>::iterator_category,
|
|
|
|
typename T = typename std::iterator_traits<WrappedIteratorT>::value_type,
|
|
|
|
typename DifferenceTypeT =
|
|
|
|
typename std::iterator_traits<WrappedIteratorT>::difference_type,
|
Use std::foo_t rather than std::foo in LLVM.
Summary: C++14 migration. No functional change.
Reviewers: bkramer, JDevlieghere, lebedev.ri
Subscribers: MatzeB, hiraditya, jkorous, dexonsmith, arphaman, kadircet, lebedev.ri, usaxena95, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D74384
2020-02-11 05:33:08 +01:00
|
|
|
typename PointerT = std::conditional_t<
|
2016-08-09 22:23:13 +02:00
|
|
|
std::is_same<T, typename std::iterator_traits<
|
|
|
|
WrappedIteratorT>::value_type>::value,
|
Use std::foo_t rather than std::foo in LLVM.
Summary: C++14 migration. No functional change.
Reviewers: bkramer, JDevlieghere, lebedev.ri
Subscribers: MatzeB, hiraditya, jkorous, dexonsmith, arphaman, kadircet, lebedev.ri, usaxena95, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D74384
2020-02-11 05:33:08 +01:00
|
|
|
typename std::iterator_traits<WrappedIteratorT>::pointer, T *>,
|
|
|
|
typename ReferenceT = std::conditional_t<
|
2016-08-09 22:23:13 +02:00
|
|
|
std::is_same<T, typename std::iterator_traits<
|
|
|
|
WrappedIteratorT>::value_type>::value,
|
Use std::foo_t rather than std::foo in LLVM.
Summary: C++14 migration. No functional change.
Reviewers: bkramer, JDevlieghere, lebedev.ri
Subscribers: MatzeB, hiraditya, jkorous, dexonsmith, arphaman, kadircet, lebedev.ri, usaxena95, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D74384
2020-02-11 05:33:08 +01:00
|
|
|
typename std::iterator_traits<WrappedIteratorT>::reference, T &>>
|
2014-04-24 05:31:23 +02:00
|
|
|
class iterator_adaptor_base
|
2014-04-29 03:57:35 +02:00
|
|
|
: public iterator_facade_base<DerivedT, IteratorCategoryT, T,
|
|
|
|
DifferenceTypeT, PointerT, ReferenceT> {
|
2017-06-14 00:11:49 +02:00
|
|
|
using BaseT = typename iterator_adaptor_base::iterator_facade_base;
|
2014-04-24 08:59:50 +02:00
|
|
|
|
2014-04-24 05:31:23 +02:00
|
|
|
protected:
|
|
|
|
WrappedIteratorT I;
|
|
|
|
|
2015-04-11 20:57:14 +02:00
|
|
|
iterator_adaptor_base() = default;
|
2014-04-24 05:31:23 +02:00
|
|
|
|
2017-02-07 04:15:12 +01:00
|
|
|
explicit iterator_adaptor_base(WrappedIteratorT u) : I(std::move(u)) {
|
|
|
|
static_assert(std::is_base_of<iterator_adaptor_base, DerivedT>::value,
|
|
|
|
"Must pass the derived type to this template!");
|
|
|
|
}
|
2014-04-24 05:31:23 +02:00
|
|
|
|
2015-06-26 01:46:41 +02:00
|
|
|
const WrappedIteratorT &wrapped() const { return I; }
|
|
|
|
|
2014-04-24 05:31:23 +02:00
|
|
|
public:
|
2017-06-14 00:11:49 +02:00
|
|
|
using difference_type = DifferenceTypeT;
|
2014-04-24 05:31:23 +02:00
|
|
|
|
|
|
|
DerivedT &operator+=(difference_type n) {
|
2014-04-30 02:49:32 +02:00
|
|
|
static_assert(
|
|
|
|
BaseT::IsRandomAccess,
|
|
|
|
"The '+=' operator is only defined for random access iterators.");
|
2014-04-24 05:31:23 +02:00
|
|
|
I += n;
|
|
|
|
return *static_cast<DerivedT *>(this);
|
|
|
|
}
|
|
|
|
DerivedT &operator-=(difference_type n) {
|
2014-04-30 02:49:32 +02:00
|
|
|
static_assert(
|
|
|
|
BaseT::IsRandomAccess,
|
|
|
|
"The '-=' operator is only defined for random access iterators.");
|
2014-04-24 05:31:23 +02:00
|
|
|
I -= n;
|
|
|
|
return *static_cast<DerivedT *>(this);
|
|
|
|
}
|
2014-04-24 08:59:50 +02:00
|
|
|
using BaseT::operator-;
|
2014-04-30 02:49:32 +02:00
|
|
|
difference_type operator-(const DerivedT &RHS) const {
|
|
|
|
static_assert(
|
|
|
|
BaseT::IsRandomAccess,
|
|
|
|
"The '-' operator is only defined for random access iterators.");
|
|
|
|
return I - RHS.I;
|
|
|
|
}
|
2014-04-24 05:31:23 +02:00
|
|
|
|
2014-04-24 06:07:06 +02:00
|
|
|
// We have to explicitly provide ++ and -- rather than letting the facade
|
|
|
|
// forward to += because WrappedIteratorT might not support +=.
|
2014-04-24 08:59:50 +02:00
|
|
|
using BaseT::operator++;
|
2014-04-24 05:31:23 +02:00
|
|
|
DerivedT &operator++() {
|
|
|
|
++I;
|
|
|
|
return *static_cast<DerivedT *>(this);
|
|
|
|
}
|
2014-04-24 08:59:50 +02:00
|
|
|
using BaseT::operator--;
|
2014-04-24 05:31:23 +02:00
|
|
|
DerivedT &operator--() {
|
2014-04-30 02:49:32 +02:00
|
|
|
static_assert(
|
|
|
|
BaseT::IsBidirectional,
|
|
|
|
"The decrement operator is only defined for bidirectional iterators.");
|
2014-04-24 05:31:23 +02:00
|
|
|
--I;
|
|
|
|
return *static_cast<DerivedT *>(this);
|
|
|
|
}
|
|
|
|
|
2020-12-17 11:41:35 +01:00
|
|
|
friend bool operator==(const iterator_adaptor_base &LHS,
|
|
|
|
const iterator_adaptor_base &RHS) {
|
|
|
|
return LHS.I == RHS.I;
|
|
|
|
}
|
|
|
|
friend bool operator<(const iterator_adaptor_base &LHS,
|
|
|
|
const iterator_adaptor_base &RHS) {
|
2014-04-30 02:49:32 +02:00
|
|
|
static_assert(
|
|
|
|
BaseT::IsRandomAccess,
|
|
|
|
"Relational operators are only defined for random access iterators.");
|
2020-12-17 11:41:35 +01:00
|
|
|
return LHS.I < RHS.I;
|
2014-04-30 02:49:32 +02:00
|
|
|
}
|
2014-04-24 05:31:23 +02:00
|
|
|
|
|
|
|
ReferenceT operator*() const { return *I; }
|
|
|
|
};
|
|
|
|
|
2018-05-01 17:54:18 +02:00
|
|
|
/// An iterator type that allows iterating over the pointees via some
|
2014-04-24 05:31:23 +02:00
|
|
|
/// other iterator.
|
|
|
|
///
|
|
|
|
/// The typical usage of this is to expose a type that iterates over Ts, but
|
|
|
|
/// which is implemented with some iterator over T*s:
|
|
|
|
///
|
|
|
|
/// \code
|
2017-06-14 00:11:49 +02:00
|
|
|
/// using iterator = pointee_iterator<SmallVectorImpl<T *>::iterator>;
|
2014-04-24 05:31:23 +02:00
|
|
|
/// \endcode
|
2014-04-24 23:10:35 +02:00
|
|
|
template <typename WrappedIteratorT,
|
Use std::foo_t rather than std::foo in LLVM.
Summary: C++14 migration. No functional change.
Reviewers: bkramer, JDevlieghere, lebedev.ri
Subscribers: MatzeB, hiraditya, jkorous, dexonsmith, arphaman, kadircet, lebedev.ri, usaxena95, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D74384
2020-02-11 05:33:08 +01:00
|
|
|
typename T = std::remove_reference_t<decltype(
|
|
|
|
**std::declval<WrappedIteratorT>())>>
|
2014-04-24 05:31:23 +02:00
|
|
|
struct pointee_iterator
|
2014-04-29 03:57:35 +02:00
|
|
|
: iterator_adaptor_base<
|
2018-06-27 02:54:36 +02:00
|
|
|
pointee_iterator<WrappedIteratorT, T>, WrappedIteratorT,
|
2014-04-29 03:57:35 +02:00
|
|
|
typename std::iterator_traits<WrappedIteratorT>::iterator_category,
|
|
|
|
T> {
|
2015-04-11 20:57:14 +02:00
|
|
|
pointee_iterator() = default;
|
2014-04-24 05:31:23 +02:00
|
|
|
template <typename U>
|
|
|
|
pointee_iterator(U &&u)
|
|
|
|
: pointee_iterator::iterator_adaptor_base(std::forward<U &&>(u)) {}
|
|
|
|
|
|
|
|
T &operator*() const { return **this->I; }
|
|
|
|
};
|
|
|
|
|
2017-03-27 14:56:12 +02:00
|
|
|
template <typename RangeT, typename WrappedIteratorT =
|
|
|
|
decltype(std::begin(std::declval<RangeT>()))>
|
|
|
|
iterator_range<pointee_iterator<WrappedIteratorT>>
|
|
|
|
make_pointee_range(RangeT &&Range) {
|
|
|
|
using PointeeIteratorT = pointee_iterator<WrappedIteratorT>;
|
|
|
|
return make_range(PointeeIteratorT(std::begin(std::forward<RangeT>(Range))),
|
|
|
|
PointeeIteratorT(std::end(std::forward<RangeT>(Range))));
|
|
|
|
}
|
|
|
|
|
2016-08-19 23:04:45 +02:00
|
|
|
template <typename WrappedIteratorT,
|
|
|
|
typename T = decltype(&*std::declval<WrappedIteratorT>())>
|
|
|
|
class pointer_iterator
|
2018-11-14 08:19:21 +01:00
|
|
|
: public iterator_adaptor_base<
|
|
|
|
pointer_iterator<WrappedIteratorT, T>, WrappedIteratorT,
|
|
|
|
typename std::iterator_traits<WrappedIteratorT>::iterator_category,
|
|
|
|
T> {
|
2016-08-19 23:04:45 +02:00
|
|
|
mutable T Ptr;
|
|
|
|
|
|
|
|
public:
|
2016-11-23 01:30:24 +01:00
|
|
|
pointer_iterator() = default;
|
2016-08-19 23:04:45 +02:00
|
|
|
|
|
|
|
explicit pointer_iterator(WrappedIteratorT u)
|
|
|
|
: pointer_iterator::iterator_adaptor_base(std::move(u)) {}
|
|
|
|
|
|
|
|
T &operator*() { return Ptr = &*this->I; }
|
|
|
|
const T &operator*() const { return Ptr = &*this->I; }
|
|
|
|
};
|
|
|
|
|
2017-03-27 14:56:12 +02:00
|
|
|
template <typename RangeT, typename WrappedIteratorT =
|
|
|
|
decltype(std::begin(std::declval<RangeT>()))>
|
|
|
|
iterator_range<pointer_iterator<WrappedIteratorT>>
|
|
|
|
make_pointer_range(RangeT &&Range) {
|
|
|
|
using PointerIteratorT = pointer_iterator<WrappedIteratorT>;
|
|
|
|
return make_range(PointerIteratorT(std::begin(std::forward<RangeT>(Range))),
|
|
|
|
PointerIteratorT(std::end(std::forward<RangeT>(Range))));
|
|
|
|
}
|
|
|
|
|
2019-12-18 11:25:19 +01:00
|
|
|
template <typename WrappedIteratorT,
|
Use std::foo_t rather than std::foo in LLVM.
Summary: C++14 migration. No functional change.
Reviewers: bkramer, JDevlieghere, lebedev.ri
Subscribers: MatzeB, hiraditya, jkorous, dexonsmith, arphaman, kadircet, lebedev.ri, usaxena95, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D74384
2020-02-11 05:33:08 +01:00
|
|
|
typename T1 = std::remove_reference_t<decltype(
|
|
|
|
**std::declval<WrappedIteratorT>())>,
|
|
|
|
typename T2 = std::add_pointer_t<T1>>
|
|
|
|
using raw_pointer_iterator =
|
|
|
|
pointer_iterator<pointee_iterator<WrappedIteratorT, T1>, T2>;
|
2019-12-18 11:25:19 +01:00
|
|
|
|
2016-11-23 01:30:24 +01:00
|
|
|
} // end namespace llvm
|
2016-10-10 18:26:03 +02:00
|
|
|
|
2016-11-23 01:30:24 +01:00
|
|
|
#endif // LLVM_ADT_ITERATOR_H
|