diff --git a/ChangeLog b/ChangeLog index 261be152d..238f68bf5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2023-02-02 Dirk Eddelbuettel + + * inst/include/Rcpp/sugar/functions/sapply.h: Enable compilation + under C++20 (using clang++ and its C++ library) via invoke_result + 2023-01-29 IƱaki Ucar * inst/tinytest/test_xptr.R: Fix a couple of tests writing to stdout diff --git a/inst/include/Rcpp/sugar/functions/sapply.h b/inst/include/Rcpp/sugar/functions/sapply.h index 2ade4063e..49ed29a3e 100644 --- a/inst/include/Rcpp/sugar/functions/sapply.h +++ b/inst/include/Rcpp/sugar/functions/sapply.h @@ -1,8 +1,7 @@ -// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- -// + // sapply.h: Rcpp R/C++ interface class library -- sapply // -// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2010 - 2023 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -33,7 +32,13 @@ template struct sapply_application_result_of { #if defined(RCPP_USING_CXX0X_OR_LATER) - typedef typename ::std::result_of::type type; + #if __cplusplus < 201703L + // deprecated by C++17, removed by C++2020, see https://en.cppreference.com/w/cpp/types/result_of + typedef typename ::std::result_of::type type; + #else + // since C++17, see https://en.cppreference.com/w/cpp/types/result_of + typedef typename ::std::invoke_result::type type; + #endif #else typedef typename ::Rcpp::traits::result_of::type type; #endif