MCPcopy Create free account
hub / github.com/boost-ext/te / Drawable

Class Drawable

example/unified.cpp:17–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15void draw(struct Circle const &, std::ostream &);
16
17struct Drawable {
18 void draw(std::ostream &out) const {
19 te::call(
20 [](auto const &self, auto &out) {
21 if
22 constexpr(std::experimental::is_detected<drawable_t, decltype(self),
23 decltype(out)>{}) {
24 self.draw(out);
25 }
26 else {
27 ::draw(self, out);
28 }
29 },
30 *this, out);
31 }
32
33 private:
34 template <class T, class... Ts>
35 using drawable_t = decltype(std::declval<T>().draw(std::declval<Ts>()...));
36};
37
38struct Square {
39 void draw(std::ostream &out) const { out << "Member Square"; }

Callers

nothing calls this directly

Calls 1

drawMethod · 0.45

Tested by

no test coverage detected