MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / memoize

Method memoize

test/testutils.cpp:589–603  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

587 }
588
589 void memoize() const {
590 int count = 0;
591 auto f = [&count]() {
592 ++count;
593 return count;
594 };
595 const auto callF = utils::memoize([&]() {
596 return f();
597 });
598 ASSERT_EQUALS(0, count);
599 ASSERT_EQUALS(1, callF());
600 ASSERT_EQUALS(1, count);
601 ASSERT_EQUALS(1, callF());
602 ASSERT_EQUALS(1, count);
603 }
604
605 void endsWith() const
606 {

Callers

nothing calls this directly

Calls 2

memoizeFunction · 0.85
fFunction · 0.50

Tested by

no test coverage detected