|
2 | 2 | // attributes.cpp: Rcpp R/C++ interface class library -- Rcpp attributes |
3 | 3 | // |
4 | 4 | // Copyright (C) 2012 - 2020 JJ Allaire, Dirk Eddelbuettel and Romain Francois |
5 | | -// Copyright (C) 2021 JJ Allaire, Dirk Eddelbuettel, Romain Francois, Iñaki Ucar and Travers Ching |
| 5 | +// Copyright (C) 2021 - 2022 JJ Allaire, Dirk Eddelbuettel, Romain Francois, Iñaki Ucar and Travers Ching |
6 | 6 | // |
7 | 7 | // This file is part of Rcpp. |
8 | 8 | // |
@@ -400,12 +400,20 @@ namespace attributes { |
400 | 400 | Param sigParam = paramNamed(kExportSignature); |
401 | 401 | std::string sig = sigParam.value(); |
402 | 402 | trimWhitespace(&sig); |
403 | | - if(sig.empty()) return sig; |
404 | | - if(sig.back() == '}') |
| 403 | + if (sig.empty()) return sig; |
| 404 | +#if __cplusplus < 201103L |
| 405 | + if (sig[sig.size() - 1] == '}') |
| 406 | +#else |
| 407 | + if (sig.back() == '}') |
| 408 | +#endif |
405 | 409 | sig = sig.substr(0, sig.size()-1); |
406 | 410 | // check sig.empty again since we deleted an element |
407 | | - if(sig.empty()) return sig; |
408 | | - if(sig.front() == '{') |
| 411 | + if (sig.empty()) return sig; |
| 412 | +#if __cplusplus < 201103L |
| 413 | + if (sig[0] == '{') |
| 414 | +#else |
| 415 | + if (sig.front() == '{') |
| 416 | +#endif |
409 | 417 | sig.erase(0,1); |
410 | 418 | return sig; |
411 | 419 | } |
@@ -2810,7 +2818,7 @@ namespace attributes { |
2810 | 2818 | // as the error message is generally more descriptive |
2811 | 2819 | CharacterVector pargs_cv = formalArgs(eval(parse(_["text"] = args))); |
2812 | 2820 | std::vector<std::string> parsed_args = |
2813 | | - Rcpp::as<std::vector<std::string>>(pargs_cv); |
| 2821 | + Rcpp::as<std::vector<std::string> >(pargs_cv); |
2814 | 2822 |
|
2815 | 2823 | for(size_t i=0; i<required_args.size(); ++i) { |
2816 | 2824 | if(std::find(parsed_args.begin(), parsed_args.end(), |
|
0 commit comments