diff --git a/ChangeLog b/ChangeLog index 0db0c96bf..b0fe180de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,32 @@ +2025-03-24 Iñaki Ucar + + * inst/include/Rcpp/exceptions.h: Include C+11 variadic template definitions + unconditionally + * inst/include/Rcpp/exceptions/cpp11/exceptions.h: Removed + * inst/include/Rcpp/exceptions/cpp98/exceptions.h: Idem + + * src/attributes.cpp: Remove obsolete pre-C+11 paths based on __cplusplus + define checks + * inst/tinytest/cpp/sugar.cpp: Idem + * inst/include/Rcpp/Language.h: Idem + * inst/include/Rcpp/StringTransformer.h: Idem + * inst/include/Rcpp/algorithm.h: Idem + * inst/include/Rcpp/utils/tinyformat.h: Idem + * inst/include/Rcpp/longlong.h: Idem, unconditional RCPP_HAS_LONG_LONG_TYPES + + * src/api.cpp: Remove explicit RCPP_HAS_LONG_LONG_TYPES as availability is + both implicit and ensured + * inst/include/Rcpp/algorithm.h: Idem + * inst/include/Rcpp/traits/is_arithmetic.h: Idem + * inst/include/Rcpp/traits/longlong.h: Idem + 2025-03-21 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll micro version and date * inst/include/Rcpp/config.h: Idem * inst/include/Rcpp/String.h: Remove explicit RCPP_USING_CXX11 as - use of C++11 (or newer) is both implicit and ensuredIdem + use of C++11 (or newer) is both implicit and ensured * inst/include/Rcpp/macros/dispatch.h: Idem * inst/include/Rcpp/platform/compiler.h: Idem * inst/include/Rcpp/unwindProtect.h: Idem diff --git a/inst/include/Rcpp/Language.h b/inst/include/Rcpp/Language.h index f7a3b5d01..a8575bf07 100644 --- a/inst/include/Rcpp/Language.h +++ b/inst/include/Rcpp/Language.h @@ -186,11 +186,7 @@ namespace Rcpp{ }; template -#if __cplusplus < 201103L - class unary_call : public std::unary_function { -#else class unary_call : public std::function { -#endif public: unary_call( Language call_ ) : call(call_), proxy(call_,1) {} unary_call( Language call_, R_xlen_t index ) : call(call_), proxy(call_,index){} @@ -207,11 +203,7 @@ namespace Rcpp{ }; template -#if __cplusplus < 201103L - class binary_call : public std::binary_function { -#else class binary_call : public std::function { -#endif public: binary_call( Language call_ ) : call(call_), proxy1(call_,1), proxy2(call_,2) {} binary_call( Language call_, R_xlen_t index1, R_xlen_t index2 ) : call(call_), proxy1(call_,index1), proxy2(call_,index2){} diff --git a/inst/include/Rcpp/StringTransformer.h b/inst/include/Rcpp/StringTransformer.h index 0824c031c..8c009ff04 100644 --- a/inst/include/Rcpp/StringTransformer.h +++ b/inst/include/Rcpp/StringTransformer.h @@ -1,7 +1,7 @@ // clone.h: Rcpp R/C++ interface class library -- clone RObject's // -// Copyright (C) 2010 - 2022 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2010 - 2025 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -26,11 +26,7 @@ namespace Rcpp{ template -#if __cplusplus < 201103L - class StringTransformer : public std::unary_function { -#else class StringTransformer : public std::function { -#endif public: StringTransformer( const UnaryOperator& op_ ): op(op_), buffer(){} ~StringTransformer(){} diff --git a/inst/include/Rcpp/algorithm.h b/inst/include/Rcpp/algorithm.h index 1080dec12..2c84815cd 100644 --- a/inst/include/Rcpp/algorithm.h +++ b/inst/include/Rcpp/algorithm.h @@ -2,7 +2,8 @@ // // algorithm.h: Rcpp R/C++ interface class library -- data frames // -// Copyright (C) 2016 - 2017 Daniel C. Dillon +// Copyright (C) 2016 - 2024 Daniel C. Dillon +// Copyright (C) 2025 Daniel C. Dillon and Iñaki Ucar // // This file is part of Rcpp. // @@ -22,14 +23,6 @@ #ifndef Rcpp__Algorithm_h #define Rcpp__Algorithm_h -#if __cplusplus >= 201103L || __INTEL_CXX11_MODE__ == 1 -# define RCPP_CONSTEXPR_FUNC constexpr -# define RCPP_CONSTEXPR_VAR constexpr -#else -# define RCPP_CONSTEXPR_FUNC -# define RCPP_CONSTEXPR_VAR const -#endif - namespace Rcpp { namespace algorithm { @@ -38,9 +31,7 @@ namespace helpers { typedef struct {char a[2];} CTYPE_SHORT; typedef struct {char a[3];} CTYPE_INT; typedef struct {char a[4];} CTYPE_LONG; -#ifdef RCPP_HAS_LONG_LONG_TYPES typedef struct {char a[5];} CTYPE_LONG_LONG; -#endif typedef struct {char a[6];} CTYPE_FLOAT; typedef struct {char a[7];} CTYPE_DOUBLE; typedef struct {char a[8];} CTYPE_LONG_DOUBLE; @@ -49,9 +40,7 @@ namespace helpers { typedef struct {char a[11];} CTYPE_UNSIGNED_SHORT; typedef struct {char a[12];} CTYPE_UNSIGNED_INT; typedef struct {char a[13];} CTYPE_UNSIGNED_LONG; -#ifdef RCPP_HAS_LONG_LONG_TYPES typedef struct {char a[14];} CTYPE_UNSIGNED_LONG_LONG; -#endif typedef struct {char a[128];} CTYPE_UNKNOWN; template< std::size_t I > @@ -69,10 +58,8 @@ namespace helpers { template<> struct ctype_helper< sizeof(CTYPE_LONG) > { typedef long type; static const bool value = true; }; -#ifdef RCPP_HAS_LONG_LONG_TYPES template<> struct ctype_helper< sizeof(CTYPE_LONG_LONG) > { typedef rcpp_long_long_type type; static const bool value = true; }; -#endif template<> struct ctype_helper< sizeof(CTYPE_FLOAT) > { typedef float type; static const bool value = true; }; @@ -98,11 +85,8 @@ namespace helpers { template<> struct ctype_helper< sizeof(CTYPE_UNSIGNED_LONG) > { typedef unsigned long type; static const bool value = true; }; -#ifdef RCPP_HAS_LONG_LONG_TYPES template<> struct ctype_helper< sizeof(CTYPE_UNSIGNED_LONG_LONG) > { typedef rcpp_ulong_long_type type; static const bool value = true; }; -#endif - template< typename T > struct ctype @@ -111,9 +95,7 @@ namespace helpers { static CTYPE_SHORT test(const short &); static CTYPE_INT test(const int &); static CTYPE_LONG test(const long &); -#ifdef RCPP_HAS_LONG_LONG_TYPES static CTYPE_LONG_LONG test(const rcpp_long_long_type &); -#endif static CTYPE_FLOAT test(const float &); static CTYPE_DOUBLE test(const double &); static CTYPE_LONG_DOUBLE test(const long double &); @@ -122,9 +104,7 @@ namespace helpers { static CTYPE_UNSIGNED_SHORT test(const unsigned short &); static CTYPE_UNSIGNED_INT test(const unsigned int &); static CTYPE_UNSIGNED_LONG test(const unsigned long &); -#ifdef RCPP_HAS_LONG_LONG_TYPES static CTYPE_UNSIGNED_LONG_LONG test(const rcpp_ulong_long_type &); -#endif static CTYPE_UNKNOWN test(...); static T make(); @@ -139,9 +119,7 @@ namespace helpers { static CTYPE_SHORT test(const short &); static CTYPE_INT test(const int &); static CTYPE_LONG test(const long &); -#ifdef RCPP_HAS_LONG_LONG_TYPES static CTYPE_LONG_LONG test(const rcpp_long_long_type &); -#endif static CTYPE_FLOAT test(const float &); static CTYPE_DOUBLE test(const double &); static CTYPE_LONG_DOUBLE test(const long double &); @@ -150,9 +128,7 @@ namespace helpers { static CTYPE_UNSIGNED_SHORT test(const unsigned short &); static CTYPE_UNSIGNED_INT test(const unsigned int &); static CTYPE_UNSIGNED_LONG test(const unsigned long &); -#ifdef RCPP_HAS_LONG_LONG_TYPES static CTYPE_UNSIGNED_LONG_LONG test(const rcpp_ulong_long_type &); -#endif static CTYPE_UNKNOWN test(...); static T make(); @@ -167,29 +143,29 @@ namespace helpers { template<> struct rtype_helper< double > { typedef double type; - static RCPP_CONSTEXPR_VAR int RTYPE = REALSXP; + static constexpr int RTYPE = REALSXP; static inline double NA() { return NA_REAL; } - static inline RCPP_CONSTEXPR_FUNC double ZERO() { return 0.0; } - static inline RCPP_CONSTEXPR_FUNC double ONE() { return 1.0; } + static inline constexpr double ZERO() { return 0.0; } + static inline constexpr double ONE() { return 1.0; } }; template<> struct rtype_helper< int > { typedef int type; - static RCPP_CONSTEXPR_VAR int RTYPE = INTSXP; + static constexpr int RTYPE = INTSXP; static inline int NA() { return NA_INTEGER; } - static inline RCPP_CONSTEXPR_FUNC int ZERO() { return 0; } - static inline RCPP_CONSTEXPR_FUNC int ONE() { return 1; } + static inline constexpr int ZERO() { return 0; } + static inline constexpr int ONE() { return 1; } }; template< typename T > struct rtype { typedef typename rtype_helper< typename ctype< T >::type >::type type; typedef rtype_helper< typename ctype< T >::type > helper_type; - static RCPP_CONSTEXPR_VAR int RTYPE = helper_type::RTYPE; + static constexpr int RTYPE = helper_type::RTYPE; static inline T NA() { return helper_type::NA(); } - static inline RCPP_CONSTEXPR_FUNC T ZERO() { return helper_type::ZERO(); } - static inline RCPP_CONSTEXPR_FUNC T ONE() { return helper_type::ONE(); } + static inline constexpr T ZERO() { return helper_type::ZERO(); } + static inline constexpr T ONE() { return helper_type::ONE(); } }; struct log { @@ -483,7 +459,4 @@ void sqrt(InputIterator begin, InputIterator end, OutputIterator out) { } // namespace algorithm } // namespace Rcpp -#undef RCPP_CONSTEXPR_FUNC -#undef RCPP_CONSTEXPR_VAR - #endif diff --git a/inst/include/Rcpp/exceptions.h b/inst/include/Rcpp/exceptions.h index 6e0774482..b5ea6011c 100644 --- a/inst/include/Rcpp/exceptions.h +++ b/inst/include/Rcpp/exceptions.h @@ -2,7 +2,8 @@ // exceptions.h: Rcpp R/C++ interface class library -- exceptions // // Copyright (C) 2010 - 2020 Dirk Eddelbuettel and Romain Francois -// Copyright (C) 2021 - 2020 Dirk Eddelbuettel, Romain Francois and Iñaki Ucar +// Copyright (C) 2021 - 2024 Dirk Eddelbuettel, Romain Francois and Iñaki Ucar +// Copyright (C) 2025 Dirk Eddelbuettel, Romain Francois, Iñaki Ucar and James J Balamuta // // This file is part of Rcpp. // @@ -170,19 +171,30 @@ struct LongjumpException { } }; -} // namespace Rcpp - + #define RCPP_ADVANCED_EXCEPTION_CLASS(__CLASS__, __WHAT__) \ + class __CLASS__ : public std::exception { \ + public: \ + __CLASS__( ) throw() : message( std::string(__WHAT__) + "." ){} \ + __CLASS__( const std::string& message ) throw() : \ + message( std::string(__WHAT__) + ": " + message + "."){} \ + template \ + __CLASS__( const char* fmt, Args&&... args ) throw() : \ + message( tfm::format(fmt, std::forward(args)... ) ){} \ + virtual ~__CLASS__() throw(){} \ + virtual const char* what() const throw() { return message.c_str(); } \ + private: \ + std::string message; \ + }; -// Determine whether to use variadic templated RCPP_ADVANCED_EXCEPTION_CLASS, -// warning, and stop exception functions or to use the generated argument macro -// based on whether the compiler supports c++11 or not. -#if __cplusplus >= 201103L -# include -#else -# include -#endif + template + inline void warning(const char* fmt, Args&&... args ) { + Rf_warning("%s", tfm::format(fmt, std::forward(args)... ).c_str()); + } -namespace Rcpp { + template + inline void NORET stop(const char* fmt, Args&&... args) { + throw Rcpp::exception( tfm::format(fmt, std::forward(args)... ).c_str() ); + } #define RCPP_EXCEPTION_CLASS(__CLASS__,__WHAT__) \ class __CLASS__ : public std::exception{ \ diff --git a/inst/include/Rcpp/exceptions/cpp11/exceptions.h b/inst/include/Rcpp/exceptions/cpp11/exceptions.h deleted file mode 100644 index 79a42e05e..000000000 --- a/inst/include/Rcpp/exceptions/cpp11/exceptions.h +++ /dev/null @@ -1,56 +0,0 @@ -// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- -// -// exceptions.h: Rcpp R/C++ interface class library -- exceptions -// -// Copyright (C) 2017 James J Balamuta -// -// This file is part of Rcpp. -// -// Rcpp is free software: you can redistribute it and/or modify it -// under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 2 of the License, or -// (at your option) any later version. -// -// Rcpp is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Rcpp. If not, see . - -#ifndef Rcpp__exceptionscpp11__h -#define Rcpp__exceptionscpp11__h - -// Required for std::forward -#include - -namespace Rcpp { - -#define RCPP_ADVANCED_EXCEPTION_CLASS(__CLASS__, __WHAT__) \ -class __CLASS__ : public std::exception { \ - public: \ - __CLASS__( ) throw() : message( std::string(__WHAT__) + "." ){} \ - __CLASS__( const std::string& message ) throw() : \ - message( std::string(__WHAT__) + ": " + message + "."){} \ - template \ - __CLASS__( const char* fmt, Args&&... args ) throw() : \ - message( tfm::format(fmt, std::forward(args)... ) ){} \ - virtual ~__CLASS__() throw(){} \ - virtual const char* what() const throw() { return message.c_str(); } \ - private: \ - std::string message; \ -}; - -template -inline void warning(const char* fmt, Args&&... args ) { - Rf_warning("%s", tfm::format(fmt, std::forward(args)... ).c_str()); -} - -template -inline void NORET stop(const char* fmt, Args&&... args) { - throw Rcpp::exception( tfm::format(fmt, std::forward(args)... ).c_str() ); -} - -} // namespace Rcpp -#endif diff --git a/inst/include/Rcpp/exceptions/cpp98/exceptions.h b/inst/include/Rcpp/exceptions/cpp98/exceptions.h deleted file mode 100644 index 79fc827d5..000000000 --- a/inst/include/Rcpp/exceptions/cpp98/exceptions.h +++ /dev/null @@ -1,177 +0,0 @@ -// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- -// -// exceptions.h: Rcpp R/C++ interface class library -- exceptions -// -// Copyright (C) 2010 - 2017 Dirk Eddelbuettel and Romain Francois -// Copyright (C) 2017 Dirk Eddelbuettel, Romain Francois, and James J Balamuta -// -// This file is part of Rcpp. -// -// Rcpp is free software: you can redistribute it and/or modify it -// under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 2 of the License, or -// (at your option) any later version. -// -// Rcpp is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Rcpp. If not, see . - -#ifndef Rcpp__exceptionscpp98__h -#define Rcpp__exceptionscpp98__h - -namespace Rcpp { - -#define RCPP_ADVANCED_EXCEPTION_CLASS(__CLASS__, __WHAT__) \ -class __CLASS__ : public std::exception{ \ - public: \ - __CLASS__( ) throw() : message( std::string(__WHAT__) + "." ){} \ - __CLASS__( const std::string& message ) throw() : message( std::string(__WHAT__) + ": " + message + "." ){} \ - template \ - __CLASS__(const char* fmt, const T1& arg1) throw() : \ - message( tfm::format(fmt, arg1 ) ){} \ - template \ - __CLASS__(const char* fmt, const T1& arg1, const T2& arg2) throw() : \ - message( tfm::format(fmt, arg1, arg2 ) ){} \ - template \ - __CLASS__(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3) throw() : \ - message( tfm::format(fmt, arg1, arg2, arg3 ) ){} \ - template \ - __CLASS__(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4) throw() : \ - message( tfm::format(fmt, arg1, arg2, arg3, arg4 ) ){} \ - template \ - __CLASS__(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4, const T5& arg5) throw() : \ - message( tfm::format(fmt, arg1, arg2, arg3, arg4, arg5 ) ){} \ - template \ - __CLASS__(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4, const T5& arg5, const T6& arg6) throw() : \ - message( tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6 ) ){} \ - template \ - __CLASS__(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4, const T5& arg5, const T6& arg6, const T7& arg7) throw() : \ - message( tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7 ) ){} \ - template \ - __CLASS__(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4, const T5& arg5, const T6& arg6, const T7& arg7, const T8& arg8) throw() : \ - message( tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 ) ){} \ - template \ - __CLASS__(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4, const T5& arg5, const T6& arg6, const T7& arg7, const T8& arg8, const T9& arg9) throw() : \ - message( tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 ) ){} \ - template \ - __CLASS__(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4, const T5& arg5, const T6& arg6, const T7& arg7, const T8& arg8, const T9& arg9, const T10& arg10) throw() : \ - message( tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 ) ){} \ - virtual ~__CLASS__() throw(){} \ - virtual const char* what() const throw() { return message.c_str() ; } \ - private: \ - std::string message ; \ -} ; \ - -// -- Start Rcpp::warning declaration - -template -inline void warning(const char* fmt, const T1& arg1) { - Rf_warning("%s", tfm::format(fmt, arg1).c_str()); -} - -template -inline void warning(const char* fmt, const T1& arg1, const T2& arg2) { - Rf_warning("%s", tfm::format(fmt, arg1, arg2).c_str()); -} - -template -inline void warning(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3) { - Rf_warning("%s", tfm::format(fmt, arg1, arg2, arg3).c_str()); -} - -template -inline void warning(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4) { - Rf_warning("%s", tfm::format(fmt, arg1, arg2, arg3, arg4).c_str()); -} - -template -inline void warning(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4, const T5& arg5) { - Rf_warning("%s", tfm::format(fmt, arg1, arg2, arg3, arg4, arg5).c_str()); -} - -template -inline void warning(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4, const T5& arg5, const T6& arg6) { - Rf_warning("%s", tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6).c_str()); -} - -template -inline void warning(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4, const T5& arg5, const T6& arg6, const T7& arg7) { - Rf_warning("%s", tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7).c_str()); -} - -template -inline void warning(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4, const T5& arg5, const T6& arg6, const T7& arg7, const T8& arg8) { - Rf_warning("%s", tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8).c_str()); -} - -template -inline void warning(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4, const T5& arg5, const T6& arg6, const T7& arg7, const T8& arg8, const T9& arg9) { - Rf_warning("%s", tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9).c_str()); -} - -template -inline void warning(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4, const T5& arg5, const T6& arg6, const T7& arg7, const T8& arg8, const T9& arg9, const T10& arg10) { - Rf_warning("%s", tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10).c_str()); -} - -// -- End Rcpp::warning declaration - -// -- Start Rcpp::stop declaration - -template -inline void NORET stop(const char* fmt, const T1& arg1) { - throw Rcpp::exception(tfm::format(fmt, arg1).c_str()); -} - -template -inline void NORET stop(const char* fmt, const T1& arg1, const T2& arg2) { - throw Rcpp::exception(tfm::format(fmt, arg1, arg2).c_str()); -} - -template -inline void NORET stop(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3) { - throw Rcpp::exception(tfm::format(fmt, arg1, arg2, arg3).c_str()); -} - -template -inline void NORET stop(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4) { - throw Rcpp::exception(tfm::format(fmt, arg1, arg2, arg3, arg4).c_str()); -} - -template -inline void NORET stop(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4, const T5& arg5) { - throw Rcpp::exception(tfm::format(fmt, arg1, arg2, arg3, arg4, arg5).c_str()); -} - -template -inline void NORET stop(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4, const T5& arg5, const T6& arg6) { - throw Rcpp::exception(tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6).c_str()); -} - -template -inline void NORET stop(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4, const T5& arg5, const T6& arg6, const T7& arg7) { - throw Rcpp::exception(tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7).c_str()); -} - -template -inline void NORET stop(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4, const T5& arg5, const T6& arg6, const T7& arg7, const T8& arg8) { - throw Rcpp::exception(tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8).c_str()); -} - -template -inline void NORET stop(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4, const T5& arg5, const T6& arg6, const T7& arg7, const T8& arg8, const T9& arg9) { - throw Rcpp::exception(tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9).c_str()); -} - -template -inline void NORET stop(const char* fmt, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4, const T5& arg5, const T6& arg6, const T7& arg7, const T8& arg8, const T9& arg9, const T10& arg10) { - throw Rcpp::exception(tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10).c_str()); -} - -// -- End Rcpp::stop declaration -} // namespace Rcpp -#endif diff --git a/inst/include/Rcpp/longlong.h b/inst/include/Rcpp/longlong.h index 711dff8a7..669489667 100644 --- a/inst/include/Rcpp/longlong.h +++ b/inst/include/Rcpp/longlong.h @@ -3,7 +3,7 @@ // longlong.h: Rcpp R/C++ interface class library -- long long support // // Copyright (C) 2013 - 2017 Dirk Eddelbuettel and Romain Francois -// Copyright (C) 2018 Dirk Eddelbuettel, Romain Francois and Kevin Ushey +// Copyright (C) 2018 - 2025 Dirk Eddelbuettel, Romain Francois and Kevin Ushey // // This file is part of Rcpp. // @@ -23,33 +23,8 @@ #ifndef RCPP_LONG_LONG_H #define RCPP_LONG_LONG_H -// long long is explicitly available to C++11 (and above) compilers -#if __cplusplus >= 201103L - typedef long long int rcpp_long_long_type; typedef unsigned long long int rcpp_ulong_long_type; # define RCPP_HAS_LONG_LONG_TYPES -// GNU compilers may make 'long long' available as an extension -// (note that __GNUC__ also implies clang, MinGW) -#elif defined(__GNUC__) - -// check to see if 'long long' is an alias for 'int64_t' -# if defined(_GLIBCXX_HAVE_INT64_T) && defined(_GLIBCXX_HAVE_INT64_T_LONG_LONG) -# include -typedef int64_t rcpp_long_long_type; -typedef uint64_t rcpp_ulong_long_type; -# define RCPP_HAS_LONG_LONG_TYPES - -// check to see if this is an older C++ compiler, but extensions are enabled -# elif defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__clang__) && defined(__LP64__)) -# if defined(__LONG_LONG_MAX__) -__extension__ typedef long long int rcpp_long_long_type; -__extension__ typedef unsigned long long int rcpp_ulong_long_type; -# define RCPP_HAS_LONG_LONG_TYPES -# endif -# endif - -#endif - #endif diff --git a/inst/include/Rcpp/traits/is_arithmetic.h b/inst/include/Rcpp/traits/is_arithmetic.h index 8cd705113..87541599b 100644 --- a/inst/include/Rcpp/traits/is_arithmetic.h +++ b/inst/include/Rcpp/traits/is_arithmetic.h @@ -3,7 +3,7 @@ // // is_wide_string.h: Rcpp R/C++ interface class library -- traits to help wrap // -// Copyright (C) 2013 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2013 - 2025 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -58,15 +58,13 @@ namespace traits{ template<> struct is_arithmetic : public true_type { }; - + template<> struct is_arithmetic : public true_type { }; template<> struct is_arithmetic : public true_type { }; -#if defined(RCPP_HAS_LONG_LONG_TYPES) - template<> struct is_arithmetic : public true_type { }; @@ -79,8 +77,6 @@ namespace traits{ template<> struct is_arithmetic : public true_type { }; -#endif - template<> struct is_arithmetic : public true_type { }; diff --git a/inst/include/Rcpp/traits/longlong.h b/inst/include/Rcpp/traits/longlong.h index c9de72ed9..7c9177824 100644 --- a/inst/include/Rcpp/traits/longlong.h +++ b/inst/include/Rcpp/traits/longlong.h @@ -2,7 +2,7 @@ // // longlong.h: Rcpp R/C++ interface class library -- long long traits // -// Copyright (C) 2013 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2013 - 2025 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -22,8 +22,6 @@ #ifndef RCPP_TRAITS_LONG_LONG_H #define RCPP_TRAITS_LONG_LONG_H -#if defined(RCPP_HAS_LONG_LONG_TYPES) - namespace Rcpp{ namespace traits{ @@ -39,6 +37,5 @@ namespace Rcpp{ template <> struct wrap_type_traits { typedef wrap_type_primitive_tag wrap_category; } ; } } -#endif #endif diff --git a/inst/include/Rcpp/utils/tinyformat.h b/inst/include/Rcpp/utils/tinyformat.h index d920e5fb9..0fd81e1d9 100644 --- a/inst/include/Rcpp/utils/tinyformat.h +++ b/inst/include/Rcpp/utils/tinyformat.h @@ -3,7 +3,7 @@ // tinyformat.h: Rcpp R/C++ interface class library -- tinyformat.h wrapper // // Copyright (C) 2008 - 2009 Dirk Eddelbuettel -// Copyright (C) 2009 - 2017 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2009 - 2025 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -27,14 +27,7 @@ namespace Rcpp { void stop(const std::string& message); } #define TINYFORMAT_ERROR(REASON) ::Rcpp::stop(REASON) - -#if __cplusplus >= 201103L #define TINYFORMAT_USE_VARIADIC_TEMPLATES -#else -// Don't use C++11 features (support older compilers) -#define TINYFORMAT_NO_VARIADIC_TEMPLATES -#endif - #define TINYFORMAT_ASSERT(cond) do if (!(cond)) ::Rcpp::stop("Assertion failed"); while(0) #include "tinyformat/tinyformat.h" diff --git a/inst/tinytest/cpp/sugar.cpp b/inst/tinytest/cpp/sugar.cpp index 3d17bd9e4..823f3db94 100644 --- a/inst/tinytest/cpp/sugar.cpp +++ b/inst/tinytest/cpp/sugar.cpp @@ -1,7 +1,7 @@ // sugar.cpp: Rcpp R/C++ interface class library -- sugar unit tests // -// Copyright (C) 2012 - 2022 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2012 - 2025 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -23,11 +23,7 @@ using namespace Rcpp ; template -#if __cplusplus < 201103L -class square : public std::unary_function { -#else class square : public std::function { -#endif public: T operator()( T t) const { return t*t ; } } ; diff --git a/src/api.cpp b/src/api.cpp index 2c855ce84..36246b0a7 100644 --- a/src/api.cpp +++ b/src/api.cpp @@ -3,7 +3,7 @@ // api.cpp: Rcpp R/C++ interface class library -- Rcpp api // // Copyright (C) 2012 - 2020 Dirk Eddelbuettel and Romain Francois -// Copyright (C) 2021 - 2023 Dirk Eddelbuettel, Romain Francois and Iñaki Ucar +// Copyright (C) 2021 - 2025 Dirk Eddelbuettel, Romain Francois and Iñaki Ucar // // This file is part of Rcpp. // @@ -185,13 +185,7 @@ SEXP rcpp_capabilities() { #endif LOGICAL(cap)[7] = FALSE; // Classic API - - #ifdef RCPP_HAS_LONG_LONG_TYPES - LOGICAL(cap)[8] = TRUE; - #else - LOGICAL(cap)[8] = FALSE; - #endif - + LOGICAL(cap)[8] = TRUE; // RCPP_HAS_LONG_LONG_TYPES LOGICAL(cap)[9] = TRUE; // HAS_CXX0X_UNORDERED_MAP LOGICAL(cap)[10] = TRUE; // HAS_CXX0X_UNORDERED_SET LOGICAL(cap)[11] = TRUE; // RCPP_USING_CXX11 diff --git a/src/attributes.cpp b/src/attributes.cpp index 33f3459c3..81c2f5bef 100644 --- a/src/attributes.cpp +++ b/src/attributes.cpp @@ -1,7 +1,7 @@ // attributes.cpp: Rcpp R/C++ interface class library -- Rcpp attributes // // Copyright (C) 2012 - 2020 JJ Allaire, Dirk Eddelbuettel and Romain Francois -// Copyright (C) 2021 - 2023 JJ Allaire, Dirk Eddelbuettel, Romain Francois, Iñaki Ucar and Travers Ching +// Copyright (C) 2021 - 2025 JJ Allaire, Dirk Eddelbuettel, Romain Francois, Iñaki Ucar and Travers Ching // // This file is part of Rcpp. // @@ -401,19 +401,11 @@ namespace attributes { std::string sig = sigParam.value(); trimWhitespace(&sig); if (sig.empty()) return sig; -#if __cplusplus < 201103L - if (sig[sig.size() - 1] == '}') -#else if (sig.back() == '}') -#endif sig = sig.substr(0, sig.size()-1); // check sig.empty again since we deleted an element if (sig.empty()) return sig; -#if __cplusplus < 201103L - if (sig[0] == '{') -#else if (sig.front() == '{') -#endif sig.erase(0,1); return sig; }