Package: cpp11 0.5.5.9000

Davis Vaughan

cpp11: A C++11 Interface for R's C Interface

Provides a header only, C++11 interface to R's C interface. Compared to other approaches 'cpp11' strives to be safe against long jumps from the C API as well as C++ exceptions, conform to normal R function semantics and supports interaction with 'ALTREP' vectors.

Authors:Davis Vaughan [aut, cre], Jim Hester [aut], Romain François [aut], Benjamin Kietzman [ctb], Posit Software, PBC [cph, fnd]

cpp11_0.5.5.9000.tar.gz
cpp11_0.5.5.9000.zip(r-4.7)cpp11_0.5.5.9000.zip(r-4.6)cpp11_0.5.5.9000.zip(r-4.5)
cpp11_0.5.5.9000.tgz(r-4.6-any)cpp11_0.5.5.9000.tgz(r-4.5-any)
cpp11_0.5.5.9000.tar.gz(r-4.7-any)cpp11_0.5.5.9000.tar.gz(r-4.6-any)
cpp11_0.5.5.9000.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
cpp11/json (API)

# Install 'cpp11' in R:
install.packages('cpp11', repos = c('https://fastverse.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/r-lib/cpp11/issues

Pkgdown/docs site:https://cpp11.r-lib.org

On CRAN:

Conda:

cppcpp11

18.71 score 225 stars 13k packages 834 scripts 1.7M downloads 5 exports 0 dependencies

Last updated from:7d0e4ac112. Checks:9 OK. Indexed: no.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK158
source / vignettesOK192
linux-release-x86_64OK145
macos-release-arm64OK97
macos-oldrel-arm64OK114
windows-develOK138
windows-releaseOK117
windows-oldrelOK119
wasm-releaseOK498

Exports:cpp_evalcpp_functioncpp_registercpp_sourcecpp_vendor

Dependencies:

cpp11 internals
Initial setup and dev workflow | Code formatting | Code organization | Naming conventions | Vector classes | Coercion functions | Protection | Protect list | Unwind Protect

Last update: 2026-05-06
Started: 2020-06-10

FAQ
1. What are the underlying types of cpp11 objects? | 2. How do I add elements to a list? | 3. Does cpp11 support default arguments? | 4. How do I create a new empty list? | 5. How do I retrieve (named) elements from a named vector/list? | 6. How can I tell whether a vector is named? | 7. How do I return a cpp11::writable::logicals object with only a FALSE value? | 8. How do I create a new empty environment? | 9. How do I assign and retrieve values in an environment? What happens if I try to get a value that doesn't exist? | 10. How can I create a cpp11:raws from a std::string? | 11. How can I create a std::string from a cpp11::writable::string? | 12. What are the types for C++ iterators? | 13. My code has using namespace std, why do I still have to include std:: in the signatures of [[cpp11::register]] functions? | 14. How do I modify a vector in place? | 15. Should I call cpp11::unwind_protect() manually? | Destructors | Nested unwind_protect() | 16. Ok but I really want to call cpp11::unwind_protect() manually

Last update: 2026-05-06
Started: 2021-07-02

Get started with cpp11
Introduction | Outline | Prerequisites | Getting started with C++ | No inputs, scalar output | Scalar input, scalar output | Vector input, scalar output | Vector input, vector output | Using cpp_source | Exercises | Other classes | Lists and data frames | Functions | Attributes | Missing values | Scalars | Integers | Doubles | Strings | Boolean | Vectors | Standard Template Library | Using iterators | Algorithms | Data structures | Vectors | Sets | Case studies | Gibbs sampler | R vectorisation versus C++ vectorisation | Using cpp11 in a package | Learning more

Last update: 2026-05-06
Started: 2020-06-10

Motivations for cpp11
Motivations | Copy-on-write semantics | Improve safety | C safety | C++ safety | Altrep support | Altrep benchmarks | UTF-8 everywhere | C++11 features | Simpler implementation | Compilation speed | Header only | Vendoring | Protection | Growing vectors | Conclusion

Last update: 2026-05-06
Started: 2020-06-10

Converting from Rcpp
Getting started | Cheatsheet | Vectors | Other objects | Functions | R functions | Unsupported Rcpp features | RNGs | Common issues when converting | STL includes | Strict headers | R API includes | Type aliases | Logical vector construction

Last update: 2024-07-26
Started: 2020-06-10