28 lines
385 B
28 lines
385 B
#include <memory>
|
|
|
|
struct Pin
|
|
{
|
|
virtual void set(bool logic);
|
|
|
|
virtual void toggle();
|
|
|
|
virtual bool get(void);
|
|
};
|
|
|
|
// https://www.modernescpp.com/index.php/c-is-still-lazy
|
|
|
|
// curiously recurring template pattern
|
|
template <typename T>
|
|
struct PinCRTP : public Pin
|
|
{
|
|
virtual override set(bool logic)
|
|
{
|
|
static_cast<>
|
|
}
|
|
};
|
|
|
|
|
|
int main(void)
|
|
{
|
|
return 0;
|
|
} |