22 #ifndef Rcpp__exceptionscpp11__h
23 #define Rcpp__exceptionscpp11__h
30 #define RCPP_ADVANCED_EXCEPTION_CLASS(__CLASS__, __WHAT__) \
31 class __CLASS__ : public std::exception { \
33 __CLASS__( ) throw() : message( std::string(__WHAT__) + "." ){} \
34 __CLASS__( const std::string& message ) throw() : \
35 message( std::string(__WHAT__) + ": " + message + "."){} \
36 template <typename... Args> \
37 __CLASS__( const char* fmt, Args&&... args ) throw() : \
38 message( tfm::format(fmt, std::forward<Args>(args)... ) ){} \
39 virtual ~__CLASS__() throw(){} \
40 virtual const char* what() const throw() { return message.c_str(); } \
42 std::string message; \
45 template <
typename... Args>
46 inline void warning(
const char* fmt, Args&&... args ) {
47 Rf_warning(
"%s",
tfm::format(fmt, std::forward<Args>(args)... ).c_str());
50 template <
typename... Args>
51 inline void NORET stop(
const char* fmt, Args&&... args) {
void warning(const char *fmt, Args &&... args)
void NORET stop(const char *fmt, Args &&... args)