MCPcopy Create free account
hub / github.com/baidu/tera / Sum

Method Sum

src/common/base/bounded_queue.h:52–60  ·  view source on GitHub ↗

tera specified

Source from the content-addressed store, hash-verified

50
51 // tera specified
52 value_type Sum() {
53 static_assert(std::is_arithmetic<value_type>::value,
54 "Only arithmetic value is able to use Sum method");
55 if (Empty()) {
56 return 0;
57 }
58 return std::accumulate(std::begin(qu_), std::end(qu_), (value_type)0,
59 [](value_type x, const value_type& y) { return x + y; });
60 }
61
62 value_type Average() {
63 static_assert(std::is_arithmetic<value_type>::value,

Callers 1

TEST_FFunction · 0.80

Calls

no outgoing calls

Tested by 1

TEST_FFunction · 0.64