MCPcopy Create free account
hub / github.com/boostorg/hana / main

Function main

example/string/foldable.cpp:15–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13
14
15int main() {
16 auto sum_string = [](auto str) {
17 return hana::fold_left(str, hana::int_c<0>, [](auto sum, auto c) {
18 constexpr int i = hana::value(c) - 48; // convert character to decimal
19 return sum + hana::int_c<i>;
20 });
21 };
22
23 BOOST_HANA_CONSTANT_CHECK(
24 sum_string(BOOST_HANA_STRING("1234")) == hana::int_c<1 + 2 + 3 + 4>
25 );
26}

Callers

nothing calls this directly

Calls 1

valueFunction · 0.50

Tested by

no test coverage detected