MCPcopy Create free account
hub / github.com/BowenFu/matchit.cpp / get_area

Function get_area

sample/Closed-Class-Hierarchy.cpp:43–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43double get_area(const Shape &shape)
44{
45 using namespace matchit;
46 Id<Circle> c;
47 Id<Rectangle> r;
48 return match(shape)(
49 pattern |
50 as<Circle>(c) = [&]
51 { return 3.14 * (*c).radius * (*c).radius; },
52 pattern | as<Rectangle>(r) = [&]
53 { return (*r).width * (*r).height; });
54}
55
56int32_t main()
57{

Callers 1

mainFunction · 0.70

Calls 1

matchFunction · 0.50

Tested by

no test coverage detected