Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable compilation under C++20 with clang++ and its standard library #1248

Merged
merged 2 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Permit C++20 compilation via clang and its standard C++ library
  • Loading branch information
eddelbuettel committed Feb 2, 2023
commit 2e6cc75eb889856e0751af74b9266af834d323d6
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2023-02-02 Dirk Eddelbuettel <edd@debian.org>

* 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 <iucar@fedoraproject.org>

* inst/tinytest/test_xptr.R: Fix a couple of tests writing to stdout
Expand Down
13 changes: 9 additions & 4 deletions inst/include/Rcpp/sugar/functions/sapply.h
Original file line number Diff line number Diff line change
@@ -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.
//
Expand Down Expand Up @@ -33,7 +32,13 @@ template <typename Function, typename SugarExpression>
struct sapply_application_result_of
{
#if defined(RCPP_USING_CXX0X_OR_LATER)
typedef typename ::std::result_of<Function(typename SugarExpression::stored_type)>::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<Function(typename SugarExpression::stored_type)>::type type;
#else
// since C++17, see https://en.cppreference.com/w/cpp/types/result_of
typedef typename ::std::invoke_result<Function(typename SugarExpression::stored_type)>::type type;
#endif
#else
typedef typename ::Rcpp::traits::result_of<Function>::type type;
#endif
Expand Down