MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / ParamIterator

Class ParamIterator

tests/gtest/gtest.h:10515–10553  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10513// and implements the const forward iterator concept.
10514template <typename T>
10515class ParamIterator {
10516 public:
10517 typedef T value_type;
10518 typedef const T& reference;
10519 typedef ptrdiff_t difference_type;
10520
10521 // ParamIterator assumes ownership of the impl_ pointer.
10522 ParamIterator(const ParamIterator& other) : impl_(other.impl_->Clone()) {}
10523 ParamIterator& operator=(const ParamIterator& other) {
10524 if (this != &other)
10525 impl_.reset(other.impl_->Clone());
10526 return *this;
10527 }
10528
10529 const T& operator*() const { return *impl_->Current(); }
10530 const T* operator->() const { return impl_->Current(); }
10531 // Prefix version of operator++.
10532 ParamIterator& operator++() {
10533 impl_->Advance();
10534 return *this;
10535 }
10536 // Postfix version of operator++.
10537 ParamIterator operator++(int /*unused*/) {
10538 ParamIteratorInterface<T>* clone = impl_->Clone();
10539 impl_->Advance();
10540 return ParamIterator(clone);
10541 }
10542 bool operator==(const ParamIterator& other) const {
10543 return impl_.get() == other.impl_.get() || impl_->Equals(*other.impl_);
10544 }
10545 bool operator!=(const ParamIterator& other) const {
10546 return !(*this == other);
10547 }
10548
10549 private:
10550 friend class ParamGenerator<T>;
10551 explicit ParamIterator(ParamIteratorInterface<T>* impl) : impl_(impl) {}
10552 std::unique_ptr<ParamIteratorInterface<T> > impl_;
10553};
10554
10555// ParamGeneratorInterface<T> is the binary interface to access generators
10556// defined in other translation units.

Callers 1

operator++Method · 0.85

Calls 4

resetMethod · 0.80
CloneMethod · 0.45
CurrentMethod · 0.45
AdvanceMethod · 0.45

Tested by 1

operator++Method · 0.68