diff --git a/include/crow/app.h b/include/crow/app.h index 065e45892..083cca618 100644 --- a/include/crow/app.h +++ b/include/crow/app.h @@ -87,7 +87,13 @@ namespace crow ///Create a route using a rule (**Use CROW_ROUTE instead**) template auto route(std::string&& rule) - -> typename std::result_of)(Router, std::string&&)>::type +#ifdef CROW_CAN_USE_CPP17 + -> typename std::invoke_result), + Router, std::string&&>::type +#else + -> typename std::result_of)( + Router, std::string&&)>::type +#endif { return router_.new_rule_tagged(std::move(rule)); } diff --git a/include/crow/settings.h b/include/crow/settings.h index ba8d3c4f0..598ed9543 100644 --- a/include/crow/settings.h +++ b/include/crow/settings.h @@ -40,6 +40,13 @@ #define CROW_CAN_USE_CPP14 #endif +#if defined(_MSVC_LANG) && _MSVC_LANG >= 201703L +#define CROW_CAN_USE_CPP17 +#endif +#if __cplusplus >= 201703L +#define CROW_CAN_USE_CPP17 +#endif + #if defined(_MSC_VER) #if _MSC_VER < 1900 #define CROW_MSVC_WORKAROUND