MCPcopy Create free account
hub / github.com/BVLC/caffe / Current

Method Current

src/gtest/gtest.h:10243–10247  ·  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

10241 // detect that fact. The client code, on the other hand, is
10242 // responsible for not calling Current() on an out-of-range iterator.
10243 virtual const T* Current() const {
10244 if (value_.get() == NULL)
10245 value_.reset(new T(*iterator_));
10246 return value_.get();
10247 }
10248 virtual bool Equals(const ParamIteratorInterface<T>& other) const {
10249 // Having the same base generator guarantees that the other
10250 // 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