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

Function distance

example/tutorial/integral.cpp:105–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103//! [distance-hana]
104template <typename P1, typename P2>
105constexpr auto distance(P1 p1, P2 p2) {
106 auto xs = p1.x - p2.x;
107 auto ys = p1.y - p2.y;
108 return sqrt(xs*xs + ys*ys);
109}
110
111BOOST_HANA_CONSTANT_CHECK(distance(point(3_c, 5_c), point(7_c, 2_c)) == 5_c);
112//! [distance-hana]

Callers 2

integral.cppFile · 0.70
testFunction · 0.70

Calls 1

sqrtFunction · 0.70

Tested by

no test coverage detected