charvec: Construct a charvec

View source: R/charvec.R

charvecR Documentation

Construct a charvec

Description

Builds a ‘charvec', charport’s reference ALTREP character vector class, from the given values. A 'charvec' is an ordinary character vector to R code ('typeof(x)' is '"character"'); its strings live as byte views in stable native memory blocks and are only converted to R's interned 'CHARSXP' strings when something forces materialization.

Usage

charvec(...)

Arguments

...

values to combine, as in [c()]; non-character values are coerced with [as.character()].

Details

Element bytes and encoding marks are preserved verbatim. 'charvec' is a storage/reference class, not an encoding-normalization layer; translation policy belongs in consumers built above charport. 'NA_character_' is preserved.

Value

A 'charvec' (an ALTREP character vector).

Examples

x <- charvec("hello", "world", NA)
is_charvec(x)
x[1]

charport documentation built on Sept. 21, 2026, 5:09 p.m.