1414#include " R_ext/Print.h" // for REprintf
1515#include " R_ext/Utils.h" // for R_CheckUserInterrupt
1616
17- #ifdef CPP4R_USE_FMT
18- #define FMT_HEADER_ONLY
19- #include " fmt/core.h"
20- #endif
21-
2217namespace cpp4r {
2318class unwind_exception : public std ::exception {
2419 public:
@@ -183,31 +178,6 @@ constexpr struct protect safe = {};
183178
184179inline void check_user_interrupt () { safe[R_CheckUserInterrupt](); }
185180
186- #ifdef CPP4R_USE_FMT
187- template <typename ... Args>
188- void stop [[noreturn]] (const char * fmt_arg, Args&&... args) {
189- std::string msg = fmt::format (fmt_arg, std::forward<Args>(args)...);
190- safe.noreturn (Rf_errorcall)(R_NilValue, " %s" , msg.c_str ());
191- }
192-
193- template <typename ... Args>
194- void stop [[noreturn]] (const std::string& fmt_arg, Args&&... args) {
195- std::string msg = fmt::format (fmt_arg, std::forward<Args>(args)...);
196- safe.noreturn (Rf_errorcall)(R_NilValue, " %s" , msg.c_str ());
197- }
198-
199- template <typename ... Args>
200- void warning (const char * fmt_arg, Args&&... args) {
201- std::string msg = fmt::format (fmt_arg, std::forward<Args>(args)...);
202- safe[Rf_warningcall](R_NilValue, " %s" , msg.c_str ());
203- }
204-
205- template <typename ... Args>
206- void warning (const std::string& fmt_arg, Args&&... args) {
207- std::string msg = fmt::format (fmt_arg, std::forward<Args>(args)...);
208- safe[Rf_warningcall](R_NilValue, " %s" , msg.c_str ());
209- }
210- #else
211181template <typename ... Args>
212182void stop [[noreturn]] (const char * fmt, Args... args) {
213183 safe.noreturn (Rf_errorcall)(R_NilValue, fmt, args...);
@@ -227,7 +197,6 @@ template <typename... Args>
227197void warning (const std::string& fmt, Args... args) {
228198 safe[Rf_warningcall](R_NilValue, fmt.c_str (), args...);
229199}
230- #endif
231200
232201namespace detail {
233202
0 commit comments