#pragma once #include #include #include #include namespace cppmp { namespace __impl { template struct is_default_impl { private: template static void impl(decltype(typename X::is_default(), int())); template static bool impl(char); public: static const bool value = std::is_same(0))>::value; }; } /** * @brief Helper class to create generic predicates. * * @tparam T_builder Builder class to pass arguments to. */ template class T_builder> struct generic_predicate { /** * @brief Helper class to check if the passed arguments would create a valid object. */ template struct is_valid : public bool_t>>::value> { }; #ifdef cppmp_supports_variable_templates /** * @brief Evaluates to true if the passed arguments would create a valid object, false otherwise. */ template static constexpr bool is_valid_v = is_valid::value; #endif /** * @brief Invoke the builder to create the requested object. * * @param args Arguments to pass to the builder. * * @return Object created from the builder. */ template constexpr decltype(auto) operator()(T_args&&... args) const { return T_builder>::apply(std::forward(args)...); } }; }