Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] result_of deprecation from c++20 workaround (PR #3846)

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] result_of deprecation from c++20 workaround (PR #3846)


Chronological Thread 
  • From: Marc Glisse <>
  • To:
  • Subject: Re: [cgal-discuss] result_of deprecation from c++20 workaround (PR #3846)
  • Date: Fri, 28 Feb 2020 19:56:27 +0100 (CET)

On Fri, 28 Feb 2020, Ahmed Essam wrote:

Hi all,

I'm Ahmed Essam, and I'm interested in applying for GSoC with you this year.

Regarding PR #3846 <https://github.com/CGAL/cgal/pull/3846>. As I
understand it, the main blocker is the deprecation of `std::result_of` from
C++20 in favor of `std::invoke_result`. I think there is a workaround that
would work with both C++11 and C++20 when the removal happens. The main
idea comes from this blogpost
https://devblogs.microsoft.com/oldnewthing/20190710-00/?p=102678.
We will use SFINAE to choose `std::invoke_of` if available, otherwise,
choose `std::result_of`. I'm not sure is the mapping of the functionalities
here covers all cases, but I think it's worth trying. Please find the code
snippet below:

https://gist.github.com/theartful/3dd554239743b4489b2356058f12a432

If you think this might work, I can make a PR for it.

The PR you mention mostly solves the issue by using neither result_of nor invoke_result. CGAL only started using result_of because decltype(auto) didn't exist at the time.

I don't think sfinae code to detect result_of/invoke_of would help much, we can use __cpp_lib_is_invocable. But we should first remove most uses of result_of, and only then see if it makes sense to keep the few remaining ones as is, with a version of result_of that forwards to invoke_result, or if using decltype or some other constructs to remove result_of would be better.

(of course this is just my opinion, others may see things differently)

--
Marc Glisse



Archive powered by MHonArc 2.6.18.

Top of Page