#define LLVM_SUPPORT_PATH_H
#include "llvm/ADT/Twine.h"
+#include "llvm/ADT/iterator.h"
#include "llvm/Support/DataTypes.h"
#include <iterator>
/// C:\foo\bar => C:,/,foo,bar
/// @endcode
class const_iterator
- : public std::iterator<std::input_iterator_tag, const StringRef> {
+ : public iterator_facade_base<const_iterator, std::input_iterator_tag,
+ const StringRef> {
StringRef Path; ///< The entire path.
StringRef Component; ///< The current component. Not necessarily in Path.
size_t Position; ///< The iterators current position within Path.
public:
reference operator*() const { return Component; }
- pointer operator->() const { return &Component; }
const_iterator &operator++(); // preincrement
bool operator==(const const_iterator &RHS) const;
- bool operator!=(const const_iterator &RHS) const { return !(*this == RHS); }
/// @brief Difference in bytes between this and RHS.
ptrdiff_t operator-(const const_iterator &RHS) const;
/// \a path in reverse order. The traversal order is exactly reversed from that
/// of \a const_iterator
class reverse_iterator
- : public std::iterator<std::input_iterator_tag, const StringRef> {
+ : public iterator_facade_base<reverse_iterator, std::input_iterator_tag,
+ const StringRef> {
StringRef Path; ///< The entire path.
StringRef Component; ///< The current component. Not necessarily in Path.
size_t Position; ///< The iterators current position within Path.
public:
reference operator*() const { return Component; }
- pointer operator->() const { return &Component; }
reverse_iterator &operator++(); // preincrement
bool operator==(const reverse_iterator &RHS) const;
- bool operator!=(const reverse_iterator &RHS) const { return !(*this == RHS); }
/// @brief Difference in bytes between this and RHS.
ptrdiff_t operator-(const reverse_iterator &RHS) const;