Open antialize opened 8 years ago
gcc 6 just implemented concepts lite, perhaps we could extend tpie to use them for pipelining, here is an example of how they work.
#include <type_traits> #include <utility> class node {}; template <typename T> concept bool pipenode() { return std::is_base_of<node, T>::value; } template <typename T> concept bool movable() { return requires(T i, T x) { {x = std::move(i)} {new T(std::move(i))} }; } template <typename T> concept bool pushable_generic() { return requires (T t, typename T::item_type i) { {t.push(i)} -> void }; } template <typename T> concept bool pushable_generic_node = pushable_generic<T>() && pipenode<T>() && movable<T>(); struct Monkey : public node{ Monkey() {} //Monkey(Monkey && m) = delete; typedef int item_type; void push(int) {} }; template <pushable_generic_node T> void hat(T node) { } int main() { hat(Monkey()); }
gcc 6 just implemented concepts lite, perhaps we could extend tpie to use them for pipelining, here is an example of how they work.