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

Method Current

tests/gtest/gtest.h:10725–10728  ·  view source on GitHub ↗

We need to use cached value referenced by iterator_ because *iterator_ can return a temporary object (and of type other then T), so just having "return &*iterator_;" doesn't work. value_ is updated here and not in Advance() because Advance() can advance iterator_ beyond the end of the range, and we cannot detect that fact. The client code, on the other hand, is responsible for not calling Current(

Source from the content-addressed store, hash-verified

10723 // detect that fact. The client code, on the other hand, is
10724 // responsible for not calling Current() on an out-of-range iterator.
10725 const T* Current() const override {
10726 if (value_.get() == nullptr) value_.reset(new T(*iterator_));
10727 return value_.get();
10728 }
10729 bool Equals(const ParamIteratorInterface<T>& other) const override {
10730 // Having the same base generator guarantees that the other
10731 // iterator is of the same type and we can downcast.

Callers

nothing calls this directly

Calls 2

getMethod · 0.80
resetMethod · 0.80

Tested by

no test coverage detected