MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / fold

Function fold

source/core/StarAlgorithm.hpp:75–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73
74template <typename Container, typename Value, typename Function>
75Value fold(Container const& l, Value v, Function f) {
76 auto i = l.begin();
77 auto e = l.end();
78 while (i != e) {
79 v = f(v, *i);
80 ++i;
81 }
82 return v;
83}
84
85// Like fold, but returns default value when container is empty.
86template <typename Container, typename Function>

Callers 2

separateBubbleFunction · 0.85
addChatActionsMethod · 0.85

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected