Skip to content

cppally

1.1.0Package record

A 'C++20' API for R

0packages depend
1.5Kdownloads / year
–test coverage
10/13flavors OK

Overview

About

A header-only 'C++20' API for manipulating R data structures from 'C++'. Provides 'C++20' concepts specific to R, custom scalar and vector classes with built-in NA handling, automatic object protection, 'SIMD' (single-instruction-multiple-data), parallelisation, and a streamlined system for registering 'C++' functions, including templates, to R. Full API reference and documentation are available at https://nicchr.github.io/cppally/.

Changes in 1.1.0

Breaking changes

  • Improved type-safety regarding implicit coercion of RScalar types. They now

can implicitly coerce **only** to their wrapped types, whereas before they

could implicitly coerce to that as well as other C types.

  • RTimeType arithmetic has been deprecated and removed.
  • Arithmetic involving r_lgl is now always promoted to r_int, matching R's

own semantics.

  • common_math_t<T, U> now never returns r_lgl, effectively treating r_lgl

as r_int.

Bug fixes

  • Fixed bug where exclusion of concepts header was affecting vignette creation on macos.
  • Fixed incorrect NA handling of r_date and r_psxct.
Show all changes in 1.1.0Hide the rest of the changes in 1.1.0
  • Fixed a bug where identical() would return false for two genuinely

identical NA_real_ values.

  • NULL optional arguments are now correctly handled.

Vector, factor and data frame arguments can now be NULL to allow for optional

argument programming from R.

  • Fixed a bug where checking exact equality (via identical) for C/C++ types

was not compiling due to template ordering issue.

r_lgl (logical) semantics

  • r_lgl can now implicitly coerce to int (and only int), consistent with

the other RScalar types.

  • r_lgl values are now always normalised on construction internally to either

0, 1, or NA.

Arithmetic

  • Integer overflow is now explicitly handled in all cppally arithmetic, returning

NA when detected. Integer addition and subtraction in particular are

written using branchless or vectorisable code, enabling SIMD vectorisation.

  • Integer in-place division /= now matches R's %/%

(floored division), instead of C's truncating division, e.g. -7L /= 2L now

gives -4 instead of -3. Division by zero or NA now correctly returns

NA instead of crashing the R session. Precision is also preserved for large

r_int64 values that previously round-tripped through double.

  • Scalar in-place arithmetic that narrows a wider result back to the left-hand

type (e.g. r_int += r_int64) now checks the value fits first,

giving NA on overflow instead of a silently wrapped result.

  • % now accepts mixed integer/float operands (e.g. r_int(7) % 2.5),

promoting and flooring consistent with R's %%.

  • Vector in-place arithmetic (+=, -=, *=, %=) now routes through the

scalar operators, fixing a bug where mixed-width operations (e.g.

r_vec<r_int> += r_vec<r_int64>) could silently truncate values, including

turning NA into 0.

Improvements

  • Better errors when passing invalid types to template functions.
  • Constructing invalid dates and date-times now returns NA instead of

an error.

  • New concept RNumber to represent number-based types like r_int and r_dbl.
  • New member is_na for RScalar types, in addition to the equivalent

is_na free function.

  • New member function na() for RScalar classes.
  • Relational operators have been extended to cover all RNumericType classes

which includes r_date and r_psxct.

From NEWS.md in the release

Install

Health

CRAN checks
3ERROR10OK
Check messages
ERRORre-building of vignette outputsr-oldrel-macos-arm64, r-oldrel-macos-x86_64, r-release-macos-x86_64

r-oldrel-macos-arm64

Error(s) in re-building vignettes:
--- re-building ‘cppally.Rmd’ using rmarkdown

Quitting from cppally.Rmd:85-467 [unnamed-chunk-5]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error:
! Compilation failed:
using C++ compiler: ‘Apple clang version 14.0.3 (clang-1403.0.22.14.1)’
using C++20
using SDK: ‘MacOSX11.3.1.sdk’
In file included from /Volumes/Temp/tmp/RtmpdHyCPu/fileca4910c8f907/src/cppally.cpp:1:
In file included from /Volumes/Builds/packages/big-sur-arm64/results/4.5/cppally.Rcheck/cppally/include/cppally/r_dispatch.h:13:
In file included from /Volumes/Builds/packages/big-sur-arm64/results/4.5/cppally.Rcheck/cppally/include/cppally/r_sexp_types.h:8:
/Volumes/Builds/packages/big-sur-arm64/results/4.5/cppally.Rcheck/cppally/include/cppally/r_concepts.h:292:25: error: no member named 'cmp_less_equal' in namespace 'std'
            return std::cmp_less_equal(
                   ~~~~~^
/Volumes/Builds/packages/big-sur-arm64/re
...[truncated]...
heck/cppally/include/cppally/r_types.h:6:
In file included from /Volumes/Builds/packages/big-sur-arm64/results/4.5/cppally.Rcheck/cppally/include/cppally/r_lgl.h:7:
/Volumes/Builds/packages/big-sur-arm64/results/4.5/cppally.Rcheck/cppally/include/cppally/r_int.h:15:15: error: substitution into constraint expression resulted in a non-constant expression
    requires (internal::lossless_numeric_cast<T, int>())
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Volumes/Builds/packages/big-sur-arm64/results/4.5/cppally.Rcheck/cppally/include/cppally/r_lgl.h:20:52: note: while checking constraint satisfaction for template 'r_int<int>' required here
  explicit constexpr r_lgl(int x) noexcept : value(r_int(x).is_na() ? x : static_cast<int>(static_cast<bool>(x)
--- failed re-building ‘vector_name_hashing.Rmd’

SUMMARY: processing the following files failed:
  ‘cppally.Rmd’ ‘functionals.Rmd’ ‘protection.Rmd’
  ‘vector_name_hashing.Rmd’

Error: Vignette re-building failed.
Execution halted

r-oldrel-macos-x86_64

Error(s) in re-building vignettes:
--- re-building ‘cppally.Rmd’ using rmarkdown

Quitting from cppally.Rmd:85-467 [unnamed-chunk-5]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error:
! Compilation failed:
using C++ compiler: ‘Apple clang version 14.0.3 (clang-1403.0.22.14.1)’
using C++20
using SDK: ‘MacOSX11.3.1.sdk’
In file included from /Volumes/Temp/tmp/Rtmpv2urhj/fileb53c248346f2/src/cppally.cpp:1:
In file included from /Volumes/Builds/packages/big-sur-x86_64/results/4.5/cppally.Rcheck/cppally/include/cppally/r_dispatch.h:13:
In file included from /Volumes/Builds/packages/big-sur-x86_64/results/4.5/cppally.Rcheck/cppally/include/cppally/r_sexp_types.h:8:
/Volumes/Builds/packages/big-sur-x86_64/results/4.5/cppally.Rcheck/cppally/include/cppally/r_concepts.h:292:25: error: no member named 'cmp_less_equal' in namespace 'std'
            return std::cmp_less_equal(
                   ~~~~~^
/Volumes/Builds/packages/big-sur-x86_6
...[truncated]...
sur-x86_64/results/4.5/cppally.Rcheck/cppally/include/cppally/r_types.h:6:
In file included from /Volumes/Builds/packages/big-sur-x86_64/results/4.5/cppally.Rcheck/cppally/include/cppally/r_lgl.h:7:
/Volumes/Builds/packages/big-sur-x86_64/results/4.5/cppally.Rcheck/cppally/include/cppally/r_int.h:15:15: error: substitution into constraint expression resulted in a non-constant expression
    requires (internal::lossless_numeric_cast<T, int>())
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Volumes/Builds/packages/big-sur-x86_64/results/4.5/cppally.Rcheck/cppally/include/cppally/r_lgl.h:20:52: note: while checking constraint satisfaction for template 'r_int<int>' required here
  explicit constexpr r_lgl(int x) noexcept : value(r_int(x).is_na() ? x : s
--- failed re-building ‘vector_name_hashing.Rmd’

SUMMARY: processing the following files failed:
  ‘cppally.Rmd’ ‘functionals.Rmd’ ‘protection.Rmd’
  ‘vector_name_hashing.Rmd’

Error: Vignette re-building failed.
Execution halted

r-release-macos-x86_64

Error(s) in re-building vignettes:
--- re-building ‘cppally.Rmd’ using rmarkdown

Quitting from cppally.Rmd:85-467 [unnamed-chunk-5]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error:
! Compilation failed:
specified C++20
using C++ compiler: ‘Apple clang version 14.0.3 (clang-1403.0.22.14.1)’
using C++20
using SDK: ‘MacOSX11.3.1.sdk’
In file included from /Volumes/Temp/tmp/RtmpeIzaBU/file14e90705c29bc/src/cppally.cpp:1:
In file included from /Volumes/Builds/packages/big-sur-x86_64/results/4.6/cppally.Rcheck/cppally/include/cppally/r_dispatch.h:13:
In file included from /Volumes/Builds/packages/big-sur-x86_64/results/4.6/cppally.Rcheck/cppally/include/cppally/r_sexp_types.h:8:
/Volumes/Builds/packages/big-sur-x86_64/results/4.6/cppally.Rcheck/cppally/include/cppally/r_concepts.h:292:25: error: no member named 'cmp_less_equal' in namespace 'std'
            return std::cmp_less_equal(
                   ~~~~~^
/Volumes/Builds/packa
...[truncated]...
Builds/packages/big-sur-x86_64/results/4.6/cppally.Rcheck/cppally/include/cppally/r_types.h:6:
In file included from /Volumes/Builds/packages/big-sur-x86_64/results/4.6/cppally.Rcheck/cppally/include/cppally/r_lgl.h:7:
/Volumes/Builds/packages/big-sur-x86_64/results/4.6/cppally.Rcheck/cppally/include/cppally/r_int.h:15:15: error: substitution into constraint expression resulted in a non-constant expression
    requires (internal::lossless_numeric_cast<T, int>())
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Volumes/Builds/packages/big-sur-x86_64/results/4.6/cppally.Rcheck/cppally/include/cppally/r_lgl.h:20:52: note: while checking constraint satisfaction for template 'r_int<int>' required here
  explicit constexpr r_lgl(int x) noexcept : value(r_in
--- failed re-building ‘vector_name_hashing.Rmd’

SUMMARY: processing the following files failed:
  ‘cppally.Rmd’ ‘functionals.Rmd’ ‘protection.Rmd’
  ‘vector_name_hashing.Rmd’

Error: Vignette re-building failed.
Execution halted

CRAN check page ↗

Slowest check: 6.9 min · r-oldrel-windows-x86_64
Status changes
  • ERROR10 OK, 3 ERRORNow
  • ERROR4 OK, 1 ERROR2026-04-29
Advisories

none known

Documentation

In release 1.1.0
READMEYes · 1,409 wordsVignettesYes · 4 · dynamicNEWSYes · 100% structured · mentions 1.1.0Citation fileNoWebsiteYes · pkgdown

The repository also keeps web-only articles.

Help pages
10 (1 internal)includes a package overview page
Examples that run
100%1 run in a plain check
Exported functions with examples
11%
Documented parameters
100%
Return-value docs
100%
Help pages citing references
0%

Downloads

1.5K
CRAN downloads in the past year
Rank #24,330 · ~4/day · ~127/mo
Daily download trend is not available in this view yet.
14830 days
50190 days
1.5K1 year
Compare downloads with other packages →
Also on43 r2u16 autocran

Repository

2Stars
0Forks
4Open issues
0Open PRs
3Releases
2,236Commits
1Commit identities
2,236 commits · Last activity 2026-10-23 · 0% stars, 30d · Default branch at 1.1.0.9000, ahead of CRAN 1.1.0 (checked 2026-10-21)
Responsiveness
How these are sampled
PRs merged (all time)
100%
Median days to close, 50 most recently updated closed issues
1
Median days to close, 50 most recently updated closed PRs
0

Stars over time

2026-04-12 · 12026-07-07 · 2
PracticesBeta

8 development-tooling and community-health practices detected across 4 families in the upstream repository

Checks run against github.com/nicchr/cppally on 2026-10-21.

Continuous integration (2)
GitHub ActionsR CMD check workflow

The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel

Docs source (4)
README.Rmdpkgdown

GitHub Pages site last deployed 2026-10-20 · The repository has a site deploy workflow

pkgdown site last built 2026-10-20

CRAN release process (1)
cran-comments.md
Lint, format, editor (1)
RStudio project
How this is detected·Detection ruleset v4 (2026-10-20)

Dependencies

Declared dependencies
23 external dependencies (excludes base and recommended)

Installing cppally adds no packages beyond those that come with R.

Depends (1)
R >= 4.5.0
Imports (0)
none
LinkingTo (0)
none
Enhances (0)
none
Reverse dependencies
0direct
0indirect

Nothing depends on this yet.

People & History

People (4)
Author, Maintainer since 0.1.0 (2026), Copyright holder
Copyright holder
Author of bundled ska_sort library
Copyright holder
Author of bundled ankerl::unordered_dense library
Copyright holder
SEXP protection mechanism in r_protect.h inspired by cpp11
Releases (3)

Pick two releases to compare their code metrics.

  • 1.1.0Latest
    record
    2026-07-12 · current release · diff ↗
  • 1.0.0
    record
    2026-04-28 · diff ↗ ·
    added 3 exports
    use_check_data_frames, use_check_factors, use_copy_on_modify
  • 0.1.0
    record
    2026-04-28
  • R
    R 4.6.0 released · 2026-04-24

Package metadata

First published
2026-04-28
Total releases
3 / 1 yrs
License
MIT + file LICENSE OSI
Minimum R
≥ 4.5.0
Download size
266 KB

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("cppally")
Christofides, N., Malte Skarupke, Martin Leitner-Ankerl, & Posit Software, PBC. (2026). cppally: A 'C++20' API for R (Version 1.1.0) [Computer software]. https://doi.org/10.32614/CRAN.package.cppally

This package has no citation file, so citation() returns this entry built from DESCRIPTION.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for cppally version 1.1.0 [Data set]. HJJB, LLC. Data release v2026-10-23. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-23, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy