1- // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2- //
1+
32// as.h: Rcpp R/C++ interface class library -- convert SEXP to C++ objects
43//
5- // Copyright (C) 2009 - 2015 Dirk Eddelbuettel and Romain Francois
4+ // Copyright (C) 2009 - 2026 Dirk Eddelbuettel and Romain Francois
65//
76// This file is part of Rcpp.
87//
@@ -30,8 +29,8 @@ namespace Rcpp {
3029
3130 template <typename T> T primitive_as (SEXP x) {
3231 if (::Rf_length (x) != 1 ) {
33- const char * fmt = " Expecting a single value: [extent=%i]." ;
34- throw ::Rcpp::not_compatible (fmt, ::Rf_length (x));
32+ const char * fmt = " Expecting a single value: [extent=%i]." ; // #nocov
33+ throw ::Rcpp::not_compatible (fmt, ::Rf_length (x)); // #nocov
3534 }
3635 const int RTYPE = ::Rcpp::traits::r_sexptype_traits<T>::rtype;
3736 Shield<SEXP> y (r_cast<RTYPE>(x));
@@ -45,14 +44,14 @@ namespace Rcpp {
4544 }
4645
4746 inline const char * check_single_string (SEXP x) {
48- if (TYPEOF (x) == CHARSXP) return CHAR (x);
47+ if (TYPEOF (x) == CHARSXP) return CHAR (x); // #nocov start
4948 if (! ::Rf_isString (x) || Rf_length (x) != 1 ) {
5049 const char * fmt = " Expecting a single string value: "
5150 " [type=%s; extent=%i]." ;
5251 throw ::Rcpp::not_compatible (fmt,
5352 Rf_type2char (TYPEOF (x)),
5453 Rf_length (x));
55- }
54+ } // #nocov end
5655
5756 return CHAR (STRING_ELT (::Rcpp::r_cast<STRSXP>(x), 0 ));
5857 }
0 commit comments