← 输入框|github.com|刷新
Skip to content

Cleanup __cplusplus checks based on C++11 availability #1370

Closed

Description

@Enchufa2
  • Remove paths that rely on older standards.
  • Include >= C++11 paths unconditionally.
  • Assess TODO in inst/include/Rcpp/sugar/functions/sapply.h:42
  • Then, RCPP_HAS_LONG_LONG_TYPES is defined unconditionally, remove checks.

Activity

  1. Enchufa2 commented on Mar 24, 2025

    @Enchufa2
    MemberAuthor

    What to do with

    #if __cplusplus >= 201103L
    #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
    // TODO this else branch can likely go
    typedef typename ::Rcpp::traits::result_of<Function>::type type;
    #endif
    };

    remains. We could remove the second branch as part of #1371, but I think that it would probably be better to remove the first branch, because I don't see how this is needed just here, and then a future improvement could be to reimplement ::Rcpp::traits::result_of using std stuff. It seems it is needed for lambdas, see #213. Then mapply and other functions won't work with lambdas either. So probably a separate issue dedicated to reimplementing result_of is indeed required.

  2. eddelbuettel commented on Mar 24, 2025

    @eddelbuettel
    Member

    I think this #else is harmless and opted to keep it. If we decide to remove it I think we can/should also look into removing it definition -- ie ::Rcpp::traits::result_of<Function>::type.

  3. Enchufa2 commented on Mar 24, 2025

    @Enchufa2
    MemberAuthor

    I pushed a branch feature/result_of_function that rewrites result_of to generalize the fix proposed for sapply, so that also lapply, mapply and outer can work with lambdas. What do you think?

  4. eddelbuettel commented on Mar 24, 2025

    @eddelbuettel
    Member

    That sounds like a good way forward.

  5. Enchufa2 commented on Mar 24, 2025

    @Enchufa2
    MemberAuthor

    Ok, then I'll rebase it when the current PR is merged, add more tests with lambdas, etc., and open a new PR for this.

  6. eddelbuettel commented on Mar 24, 2025

    @eddelbuettel
    Member

    That sounds even better!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions