MCPcopy Create free account
hub / github.com/apache/singa / Current

Method Current

test/gtest/gtest.h:10308–10312  ·  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

10306 // detect that fact. The client code, on the other hand, is
10307 // responsible for not calling Current() on an out-of-range iterator.
10308 virtual const T* Current() const {
10309 if (value_.get() == NULL)
10310 value_.reset(new T(*iterator_));
10311 return value_.get();
10312 }
10313 virtual bool Equals(const ParamIteratorInterface<T>& other) const {
10314 // Having the same base generator guarantees that the other
10315 // iterator is of the same type and we can downcast.

Callers

nothing calls this directly

Calls 2

getMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected