MCPcopy Create free account
hub / github.com/andreasfertig/programming-with-cpp20 / addCurrency

Function addCurrency

03.20-rangesCustomAdaptor1/main.cpp:11–16  ·  view source on GitHub ↗

#B A function returning a callable

Source from the content-addressed store, hash-verified

9
10// #B A function returning a callable
11auto addCurrency(const std::string& suffix)
12{
13 // #C Make sure you capture by copy!
14 return std::views::transform(
15 [suffix](auto i) { return std::to_string(i) + suffix; });
16}
17
18int main()
19{

Callers 1

mainFunction · 0.85

Calls 1

to_stringFunction · 0.50

Tested by

no test coverage detected