diff --git a/include/crow/app.h b/include/crow/app.h index 6fd288222..c906215aa 100644 --- a/include/crow/app.h +++ b/include/crow/app.h @@ -708,6 +708,8 @@ namespace crow template std::tuple make_middleware_tuple(Ts&&... ts) { + static_assert(black_magic::type_pack::template is_superset_of::value, "Constructor argument types must be a subset of the Crow template types"); + auto fwd = std::forward_as_tuple((ts)...); return std::make_tuple( std::forward( diff --git a/include/crow/utility.h b/include/crow/utility.h index 7be9a814c..283911849 100644 --- a/include/crow/utility.h +++ b/include/crow/utility.h @@ -453,6 +453,32 @@ namespace crow struct contains : std::false_type {}; + template + struct contains_decayed : std::true_type + {}; + + template + struct contains_decayed : + std::conditional::type, typename std::decay::type>::value, std::true_type, contains_decayed>::type + {}; + + template + struct contains_decayed : std::false_type + {}; + + template + struct type_pack + { + template + struct is_superset_of : std::true_type + {}; + + template + struct is_superset_of : + std::conditional::value, is_superset_of, std::false_type>::type + {}; + }; + template struct empty_context {};