diff --git a/include/aidge/utils/Registrar.hpp b/include/aidge/utils/Registrar.hpp index 1d76d859e32729b2bd0e5929b9511a8718245fbb..6323b2abdff937de429bbe91723aa55678ac67e9 100644 --- a/include/aidge/utils/Registrar.hpp +++ b/include/aidge/utils/Registrar.hpp @@ -141,4 +141,13 @@ void declare_registrable(py::module& m, const std::string& class_name){ } +#define CONCAT(a, b) CONCAT_INNER(a, b) +#define CONCAT_INNER(a, b) a ## b + +#define REGISTRAR(cls, ...) \ + namespace { \ + static Registrar<cls> CONCAT(CONCAT(aidge_register_ , cls), __COUNTER__)(__VA_ARGS__); \ + } \ + static_assert(true, "") + #endif //AIDGE_CORE_UTILS_REGISTRAR_H_