Dobiasd / FunctionalPlus

Functional Programming Library for C++. Write concise and readable C++ code.
http://www.editgym.com/fplus-api-search/
Boost Software License 1.0
2.07k stars 168 forks source link

composition.hpp uses std::result_of #266

Closed pejupeju closed 1 year ago

pejupeju commented 1 year ago

std::result_of has been deprecated in Visual Studio C++ 22, use std::invoke_result instead

Dobiasd commented 1 year ago

Hi, and thanks for the info. :+1:

Would you like to submit a pull request with a fix?

pejupeju commented 1 year ago

I'll try, I have never done that before

Dobiasd commented 1 year ago

Just noticed, std::invoke_result is only available since C++17. But FunctionalPlus also supports C++14. In case we would switch from std::result_of to std::invoke_result, we would need to drop C++14 support.

But luckily, we already have internal::invoke_result (and internal::invoke_result_t) for exactly that case in the library.

So we would replace std::result_of with internal::invoke_result. :bulb:

In case you prefer, I can also just push such a commit, so you would not need to create a pull request. :relaxed:

pejupeju commented 1 year ago

I was going to look into this, you are right it will not work for C++14, I had thought to have an ugly #ifdef, but your solution is better. So go ahead, and meanwhile, I'll learn how to do this properly

Dobiasd commented 1 year ago

Fixed. :heavy_check_mark: If you use the latest version from the master branch, Visual Studio should stop complaining. :slightly_smiling_face:

Thanks again for the remark. :+1: