MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / UnwrappingIterator

Class UnwrappingIterator

tensorflow/compiler/xla/iterator_util.h:59–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57// input_iterator -- it doesn't inherit any superpowers NestedIterator may have.
58template <typename NestedIter>
59class UnwrappingIterator
60 : public std::iterator<std::input_iterator_tag,
61 decltype(std::declval<NestedIter>()->get())> {
62 private:
63 NestedIter iter_;
64
65 public:
66 explicit UnwrappingIterator(NestedIter iter) : iter_(std::move(iter)) {}
67
68 auto operator*() -> decltype(iter_->get()) { return iter_->get(); }
69 auto operator-> () -> decltype(iter_->get()) { return iter_->get(); }
70 UnwrappingIterator& operator++() {
71 ++iter_;
72 return *this;
73 }
74 UnwrappingIterator operator++(int) {
75 UnwrappingIterator temp(iter_);
76 operator++();
77 return temp;
78 }
79
80 friend bool operator==(const UnwrappingIterator& a,
81 const UnwrappingIterator& b) {
82 return a.iter_ == b.iter_;
83 }
84
85 friend bool operator!=(const UnwrappingIterator& a,
86 const UnwrappingIterator& b) {
87 return !(a == b);
88 }
89};
90
91template <typename NestedIter>
92UnwrappingIterator<NestedIter> MakeUnwrappingIterator(NestedIter iter) {

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected