Skip to content

Commit

Permalink
Merge pull request #265 from Leon0402/feature/cpp20Support
Browse files Browse the repository at this point in the history
MSVC C++20 Support
  • Loading branch information
The-EDev authored Nov 3, 2021
2 parents 6f2eeda + 2dc07aa commit b5137c5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 7 additions & 1 deletion include/crow/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,13 @@ namespace crow
///Create a route using a rule (**Use CROW_ROUTE instead**)
template <uint64_t Tag>
auto route(std::string&& rule)
-> typename std::result_of<decltype(&Router::new_rule_tagged<Tag>)(Router, std::string&&)>::type
#ifdef CROW_CAN_USE_CPP17
-> typename std::invoke_result<decltype(&Router::new_rule_tagged<Tag>),
Router, std::string&&>::type
#else
-> typename std::result_of<decltype (&Router::new_rule_tagged<Tag>)(
Router, std::string&&)>::type
#endif
{
return router_.new_rule_tagged<Tag>(std::move(rule));
}
Expand Down
7 changes: 7 additions & 0 deletions include/crow/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b5137c5

Please sign in to comment.