File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ template <class BASE> class identity : public BASE {}; // derived is the base
3232#define ARCHETYPE_METHOD (ret, name, ...) \
3333 (ARCH_PP_UNIQUE_NAME(name), ret, name, __VA_ARGS__)
3434
35+ #define ARCHETYPE_CHECK (ARCHETYPE, TYPE )\
36+ static_assert (ARCHETYPE::check<TYPE>::value, STRINGIFY(TYPE must satisfy ARCHETYPE::check));
37+
3538#define ARCHETYPE_DEFINE (NAME, METHODS ) \
3639 struct NAME { \
3740 NAME () = delete ; \
@@ -58,6 +61,7 @@ template <class BASE> class identity : public BASE {}; // derived is the base
5861 \
5962 protected: \
6063 template <typename T> void bind (T &t) { \
64+ ARCHETYPE_CHECK (NAME, T) \
6165 this ->B ::bind (t); \
6266 ARCH_PP_EXPAND_CALLSTUB_ASSIGNMENTS (METHODS) \
6367 } \
@@ -354,7 +358,7 @@ public: \
354358#define ARCH_PP_COMMA_IF_ARGS_1 ,
355359#define ARCH_PP_COMMA_IF_ARGS_0
356360
357- // utility (conARCH_PP_CATenation )
361+ // utility (concatenation )
358362#define M_CONC (A, B ) M_CONC_(A, B)
359363#define M_CONC_ (A, B ) A##B
360364
You can’t perform that action at this time.
0 commit comments