Skip to content

Conversation

Leon0402
Copy link
Contributor

@Leon0402 Leon0402 commented Nov 3, 2021

Add Support for Windows MSVC

@The-EDev
Copy link
Member

The-EDev commented Nov 3, 2021

Extra context (I was writing a description for a different PR (same branch though) and @Leon0402 beat me to it 😅)

Crow currently fails to compile on C++20. This is because of the following function:

Crow/include/crow/app.h

Lines 87 to 94 in 6f2eeda

///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
{
return router_.new_rule_tagged<Tag>(std::move(rule));
}

Specifically std::result_of, which was deprecated in C++17 and removed in C++20.
This PR adds a macro to check for C++17 (or later) availability, and based on that replaces std::result_of with std::invoke_result which was introduced in C++17 as a replacement to std::result_of

Copy link
Collaborator

@luca-schlecker luca-schlecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. 🎉 Tested it locally, tests are passing for me and it compiles fine with C++20. 👍 I've tested the helloworld example on Linux.

Copy link
Member

@The-EDev The-EDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did the same as @luca-schlecker, seems to be working fine. Will merge once tests are complete

@The-EDev The-EDev merged commit b5137c5 into CrowCpp:master Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants