A dynamic value for scalars, collections, symbols, expressions, and native objects.
cvar
Types, constants & data
static constexpr uint8_t None = 1;
static constexpr uint8_t Null = 2;
static constexpr uint8_t Bool = 4;
static constexpr uint8_t Integer = 5;
static constexpr uint8_t Float = 6;
static constexpr uint8_t String = 7;
static constexpr uint8_t Symbol = 8;
static constexpr uint8_t Vector = 9;
static constexpr uint8_t Function = 10;
static constexpr uint8_t Map = 11;
static constexpr uint8_t Buffer = 12;
static constexpr uint8_t Packed = 13;
static constexpr uint8_t Reference = 14;
static constexpr uint8_t Pointer = 15;
static constexpr uint8_t Set = 16;
static constexpr uint8_t Object = 17;
static constexpr uint16_t Lambda0 = 260;
static constexpr uint16_t Lambda1 = 261;
static constexpr uint16_t Lambda2 = 262;
static constexpr uint16_t Lambda3 = 263;
static constexpr uint16_t Lambda4 = 264;
static constexpr uint16_t Lambda5 = 265;
static constexpr uint16_t Lambda6 = 266;
static constexpr uint16_t Lambda7 = 267;
static constexpr uint16_t Lambda8 = 268;
static constexpr uint16_t Lambda9 = 269;
static constexpr uint16_t Lambda10 = 270;
static constexpr uint16_t Lambda11 = 271;
static constexpr uint16_t Lambda12 = 272;
static constexpr uint16_t Lambda13 = 273;
static constexpr uint16_t Lambda14 = 274;
static constexpr uint16_t Lambda15 = 275;
using Func0 = std::function<cvar()>;
using Func1 = std::function<cvar(const cvar&)>;
using Func2 = std::function<cvar(const cvar&, const cvar&)>;
using Func11 = std::function<cvar( const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&)>;
using Func12 = std::function<cvar( const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&)>;
using Func13 = std::function<cvar( const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&)>;
using Func14 = std::function<cvar( const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&)>;
using Func15 = std::function<cvar( const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&, const cvar&)>;
enum : uint8_t { False = 3, True = 4, Tag = 19, SmallInt0 = 20, SmallInt1, SmallInt2, SmallInt3, SmallInt4, SmallInt5, SmallInt6, SmallInt7, SmallInt8, SmallInt9, SmallInt10, SmallInt11, SmallInt12, SmallInt13, SmallInt14, SmallInt15, SmallInt16, SmallInt17, SmallInt18, SmallInt19, SmallInt20, SmallInt21, SmallInt22, SmallInt23, SmallInt24, SmallInt25, SmallInt26, SmallInt27, SmallInt28, SmallInt29, SmallInt30, SmallInt31, SmallInt32, SmallInt33, SmallInt34, SmallInt35, SmallInt36, SmallInt37, SmallInt38, SmallInt39, SmallInt40, SmallInt41, SmallInt42, SmallInt43, SmallInt44, SmallInt45, SmallInt46, SmallInt47, SmallInt48, SmallInt49, SmallInt50, SmallInt51, SmallInt52, SmallInt53, SmallInt54, SmallInt55, SmallInt56, SmallInt57, SmallInt58, SmallInt59, SmallInt60, SmallInt61, SmallInt62, SmallInt63, SmallInt64, SmallInt65, SmallInt66, SmallInt67, SmallInt68, SmallInt69, SmallInt70, SmallInt71, SmallInt72, SmallInt73, SmallInt74, SmallInt75, SmallInt76, SmallInt77, SmallInt78, SmallInt79, SmallInt80, SmallInt81, SmallInt82, SmallInt83, SmallInt84, SmallInt85, SmallInt86, SmallInt87, SmallInt88, SmallInt89, SmallInt90, SmallInt91, SmallInt92, SmallInt93, SmallInt94, SmallInt95, SmallInt96, SmallInt97, SmallInt98, SmallInt99, SmallInt100, SmallInt101, SmallInt102, SmallInt103, SmallInt104, SmallInt105, SmallInt106, SmallInt107, SmallInt108, SmallInt109, SmallInt110, SmallInt111, SmallInt112, SmallInt113, SmallInt114, SmallInt115, SmallInt116, SmallInt117, SmallInt118, SmallInt119, SmallInt120, SmallInt121, SmallInt122, SmallInt123, SmallInt124, SmallInt125, SmallInt126, SmallInt127, Int8, Int16, Int32, Float32, SmallString0, SmallString1, SmallString2, SmallString3, SmallString4, SmallString5, SmallString6, SmallString7, SmallString8, SmallString9, SmallString10, SmallString11, SmallString12, SmallString13, SmallString14, SmallString15, SmallString, SmallVector0, SmallVector1, SmallVector2, SmallVector3, SmallVector4, SmallVector5, SmallVector6, SmallVector7, SmallVector8, SmallVector9, SmallVector10, SmallVector11, SmallVector12, SmallVector13, SmallVector14, SmallVector15, SmallVector, SmallMap0, SmallMap1, SmallMap2, SmallMap3, SmallMap4, SmallMap5, SmallMap6, SmallMap7, SmallMap8, SmallMap9, SmallMap10, SmallMap11, SmallMap12, SmallMap13, SmallMap14, SmallMap15, SmallMap, SmallSymbol0, SmallSymbol1, SmallSymbol2, SmallSymbol3, SmallSymbol4, SmallSymbol5, SmallSymbol6, SmallSymbol7, SmallSymbol8, SmallSymbol9, SmallSymbol10, SmallSymbol11, SmallSymbol12, SmallSymbol13, SmallSymbol14, SmallSymbol15, SmallSymbol, SmallFunction0, SmallFunction1, SmallFunction2, SmallFunction3, SmallFunction4, SmallFunction5, SmallFunction6, SmallFunction7, SmallFunction8, SmallFunction9, SmallFunction10, SmallFunction11, SmallFunction12, SmallFunction13, SmallFunction14, SmallFunction15, SmallFunction, InlineBuffer, InlinePacked, SmallSet };
static constexpr uint32_t VId = 0x73f3719f;
static constexpr uint8_t InlineBuffers = 0b1;
Methods
Constructs a dynamic value, Null by default; initializer lists form vectors. CBuffer& decodes a serialized value, whereas CBuffer* transfers ownership of a nonpersistent buffer. A cvar* creates a borrowed reference, void* a borrowed native pointer, and CObject* a reference-counted object value.
cvar& operator=(const ctag& t) noexcept;
cvar& operator=(const cvar& v);
cvar& operator=(cvar&& v) noexcept;
cvar& operator=(std::initializer_list<cvar> il);
template<class T, int N> cvar& operator=(const CPVector<T, N>& v);
template<class T, size_t N> cvar& operator=(const CArray<T, N>& v);
cvar& operator=(bool x) noexcept;
template<CInteger T> cvar& operator=(T x) noexcept;
template<CFloat T> cvar& operator=(T x) noexcept;
template<CString T> cvar& operator=(T&& x);
template<class T> requires(CSame<T, cvec>) cvar& operator=(T&& x);
template<class T> requires(CSame<T, cset>) cvar& operator=(T&& x);
template<class T> requires(CSame<T, cmap>) cvar& operator=(T&& x);
cvar& operator=(CBuffer* b) noexcept;
template<class T> requires(CSame<T, csym>) cvar& operator=(T&& x);
template<class T> requires(CSame<T, cfunc>) cvar& operator=(T&& x);
cvar& operator=(void* x) noexcept;
cvar& operator=(CObject* x) noexcept;
cvar& operator=(cvar* x) noexcept;
template<class T> cvar& operator=(const std::atomic<T>& a) noexcept(noexcept(*this = a.load()));
template<CString K> cvar& operator=(const cvar_proxy<K>& x);
Replaces this value, releasing its previous owned contents. Pointer overloads retain the constructor ownership distinctions; assigning a value to a reference-valued cvar is different from explicitly writing through its referent.
template<class T> void to(CVector<T>& x) const;
template<class T> void to(CList<T>& x) const;
template<class T> void to(CDeque<T>& x) const;
template<class T> void to(CSet<T>& x) const;
template<class T> void to(CHashSet<T>& x) const;
template<class K, class V, class H> void to(CHashMap<K, V, H>& x) const;
template<class K, class V> void to(CMap<K, V>& x) const;
template<class K, class V> void to(CMultimap<K, V>& x) const;
Inserts converted elements into the destination container; existing destination contents are retained.
ctag& tag() noexcept;
ctag tag() const noexcept;
Returns the effective tag, following explicit references.
ctag& rawTag() noexcept;
ctag rawTag() const noexcept;
Returns the stored tag directly.
uint8_t type() const noexcept;
Returns the effective type, following explicit references.
uint8_t rawType() const noexcept;
Returns the stored tag’s type code without following a reference.
uint16_t kind() const noexcept;
Returns the application-defined kind code from the effective tag, following a reference.
uint16_t rawKind() const noexcept;
Returns the kind code on this value’s own tag without following a reference.
Returns the # entry of a map, follows a reference, or returns this value for other types.
template<uint8_t Flags = 0> static void storeVec(CBuffer& b, const cvec& v);
Writes a vector in the tagged cvar serialization format, including its length and recursively stored elements. Serialization flags are forwarded to each element.
template<uint8_t Flags = 0> static void storeSet(CBuffer& b, const cset& v);
Writes a set in the tagged cvar serialization format. Element order follows set iteration; serialization flags are forwarded to each value.
template<uint8_t Flags = 0> static void storeMap(CBuffer& b, const cmap& m);
Writes a map in the tagged cvar serialization format, including key strings and recursively stored values. Serialization flags are forwarded to the values.
template<uint8_t Flags = 0> void store(CBuffer& b) const;
Appends the value in Catalyst’s binary representation. Set the InlineBuffers template flag to inline attached buffers.
template<class T> T restore();
Extracts a native T from a Buffer value using CBuffer::get<T>(), then consumes the buffer and leaves this value Null.
template<class T> requires(std::same_as<T, bool>) bool as() const;
template<CNumeric T> T as() const;
template<class T> requires(std::same_as<T, int64_t&>) int64_t& as();
template<class T> requires(std::same_as<T, double&>) double& as();
template<class T> requires(CSame<T, cstr>) cstr& as();
template<class T> requires(CSame<T, cstr>) const cstr& as() const;
template<class T> requires(CSame<T, cvec>) cvec& as();
template<class T> requires(CSame<T, cvec>) const cvec& as() const;
template<class T> requires(CSame<T, cset>) cset& as();
template<class T> requires(CSame<T, cset>) const cset& as() const;
template<class T, int N> requires(std::same_as<T, CPVector<T, N>>) CPVector<T, N> as() const;
template<class T> requires(CSame<T, cmap>) cmap& as();
template<class T> requires(CSame<T, cmap>) const cmap& as() const;
template<class T> requires(CSame<T, csym>) csym& as();
template<class T> requires(CSame<T, csym>) const csym& as() const;
template<class T> requires(CSame<T, cfunc>) cfunc& as();
template<class T> requires(CSame<T, cfunc>) const cfunc& as() const;
template<class T> requires(std::is_pointer_v<T> && !std::is_convertible_v<T, const CObject*>) T as() const;
template<class T> requires(std::is_pointer_v<T> && std::is_convertible_v<T, const CObject*>) T as() const;
template<class T> requires(CSame<T, CBuffer>) CBuffer& as();
template<class T> requires(CSame<T, CBuffer>) const CBuffer& as() const;
Checked typed access or scalar conversion. Unsupported conversions raise CError; returned references remain borrowed.
template<class T> requires(CSame<T, cvar>) cvar& get() noexcept;
template<class T> requires(CSame<T, cvar>) const cvar& get() const noexcept;
template<class T> requires(CSame<T, bool>) bool get() const noexcept;
template<class T> requires(CSame<T, int64_t>) int64_t& get() noexcept;
template<class T> requires(CSame<T, double>) double& get() noexcept;
template<CInteger T> T get() const noexcept;
template<CFloat T> T get() const noexcept;
template<class T> requires(CSame<T, cstr>) cstr& get() noexcept;
template<class T> requires(CSame<T, cstr>) const cstr& get() const noexcept;
template<class T> requires(CSame<T, cvec>) cvec& get() noexcept;
template<class T> requires(CSame<T, cvec>) const cvec& get() const noexcept;
template<class T, int N> requires(std::same_as<T, CPVector<T, N>>) CPVector<T, N> get() const;
template<class T> requires(CSame<T, cset>) cset& get() noexcept;
template<class T> requires(CSame<T, cset>) const cset& get() const noexcept;
template<class T> requires(CSame<T, cmap>) cmap& get() noexcept;
template<class T> requires(CSame<T, cmap>) const cmap& get() const noexcept;
template<class T> requires(CSame<T, csym>) csym& get() noexcept;
template<class T> requires(CSame<T, csym>) const csym& get() const noexcept;
template<class T> requires(CSame<T, cfunc>) cfunc& get() noexcept;
template<class T> requires(CSame<T, cfunc>) const cfunc& get() const noexcept;
template<class T> requires(std::is_pointer_v<T> && !std::is_convertible_v<T, const CObject*>) T get() noexcept;
template<class T> requires(std::is_pointer_v<T> && std::is_convertible_v<T, const CObject*>) T get() noexcept;
template<class T> requires(CSame<T, CBuffer>) CBuffer& get() noexcept;
template<class T> requires(CSame<T, CBuffer>) const CBuffer& get() const noexcept;
template<CString K> cvar get(K&& k, const cvar& def) const;
cvar get(const cvar& k, const cvar& def) const;
Typed zero-argument overloads require the matching stored type. Key-and-default overloads return a value or the fallback without inserting the key.
template<class T> requires(std::same_as<T, void>) bool is() const noexcept;
template<class T> requires(std::same_as<T, bool>) bool is() const noexcept;
template<CInteger T> bool is() const noexcept;
template<CFloat T> bool is() const noexcept;
template<class T> requires(CSame<T, cstr>) bool is() const noexcept;
template<class T> requires(CSame<T, cvec>) bool is() const noexcept;
template<class T> requires(CSame<T, cset>) bool is() const noexcept;
template<class T> requires(CSame<T, cmap>) bool is() const noexcept;
template<class T> requires(CSame<T, csym>) bool is() const noexcept;
template<class T> requires(CSame<T, cfunc>) bool is() const noexcept;
template<class T> requires(CSame<T, CBuffer>) bool is() const noexcept;
template<class T> requires(std::is_pointer_v<T> && !std::is_convertible_v<T, const CObject*>) bool is() const noexcept;
template<class T> requires(std::is_pointer_v<T> && std::is_convertible_v<T, const CObject*>) bool is() const noexcept;
Checks the effective stored category for T, following references. It does not test whether as<T>() could perform a conversion; is<CBuffer>() accepts both Buffer and Packed.
cvar& operator*() const noexcept;
template<class T> cvar operator*(T&& x) const;
template<CNumeric T> friend cvar operator*(T x, const cvar& v);
Performs dynamic mul arithmetic on numeric values or component-wise on compatible vectors. Unsupported operands raise CError; vector sizes must be compatible. The zero-argument unary overload instead returns a borrowed referent, or this value for a non-reference.
cvar& deref() const noexcept;
Returns the referent for an ordinary reference, but preserves a reference carrying the no-dereference flag. This supports interpreter value/lvalue handling; it does not copy the value.
Follows references and dispatches the runtime Star operation for an object. Ordinary non-object values are returned as value copies.
cvar* operator->() const noexcept;
Returns the referenced cvar, or this value for a non-reference. The returned pointer is borrowed and does not extend the referent’s lifetime.
__attribute__((used)) cstr dump() const;
Returns the same display text as toStr(). Use a CSON/JSON generator or binary storage for an explicit document format.
Formats the value as display text; string values return their contents without adding quotes. Objects may provide a Str method, otherwise their address is formatted.
template<class T> cvar& operator<<(T&& x);
friend std::ostream& operator<<(std::ostream& ostr, const cvar& v);
Appends to a vector or function argument list, or inserts into a set. A Null value becomes a vector on first insertion; objects receive Push. Returns this value for chaining.
template<class T> void pushFront(T&& x);
Prepends to a vector or function argument list. A Null value becomes a vector; objects receive pushFront.
cvar& operator[](size_t i);
const cvar& operator[](size_t i) const;
template<CString K> cvar_proxy<K> operator[](K&& k);
template<CString K> const cvar_proxy<K> operator[](K&& k) const;
Numeric indices borrow vector elements or function arguments and must be in range. String keys return a map proxy: writes can insert keys, while const access requires a map. Proxies borrow their parent and may borrow the key.
cvar operator()() const;
cvar operator()(const cvar& v1) const;
cvar operator()(const cvar& v1, const cvar& v2) const;
cvar operator()(const cvar& v1, const cvar& v2, const cvar& v3) const;
cvar operator()(const cvar& v1, const cvar& v2, const cvar& v3, const cvar& v4) const;
cvar operator()(const cvar& v1, const cvar& v2, const cvar& v3, const cvar& v4, const cvar& v5) const;
cvar operator()(const cvar& v1, const cvar& v2, const cvar& v3, const cvar& v4, const cvar& v5, const cvar& v6) const;
cvar operator()(const cvar& v1, const cvar& v2, const cvar& v3, const cvar& v4, const cvar& v5, const cvar& v6, const cvar& v7) const;
cvar operator()(const cvar& v1, const cvar& v2, const cvar& v3, const cvar& v4, const cvar& v5, const cvar& v6, const cvar& v7, const cvar& v8) const;
cvar operator()(const cvar& v1, const cvar& v2, const cvar& v3, const cvar& v4, const cvar& v5, const cvar& v6, const cvar& v7, const cvar& v8, const cvar& v9) const;
cvar operator()(const cvar& v1, const cvar& v2, const cvar& v3, const cvar& v4, const cvar& v5, const cvar& v6, const cvar& v7, const cvar& v8, const cvar& v9, const cvar& v10) const;
cvar operator()(const cvar& v1, const cvar& v2, const cvar& v3, const cvar& v4, const cvar& v5, const cvar& v6, const cvar& v7, const cvar& v8, const cvar& v9, const cvar& v10, const cvar& v11) const;
cvar operator()(const cvar& v1, const cvar& v2, const cvar& v3, const cvar& v4, const cvar& v5, const cvar& v6, const cvar& v7, const cvar& v8, const cvar& v9, const cvar& v10, const cvar& v11, const cvar& v12) const;
cvar operator()(const cvar& v1, const cvar& v2, const cvar& v3, const cvar& v4, const cvar& v5, const cvar& v6, const cvar& v7, const cvar& v8, const cvar& v9, const cvar& v10, const cvar& v11, const cvar& v12, const cvar& v13) const;
cvar operator()(const cvar& v1, const cvar& v2, const cvar& v3, const cvar& v4, const cvar& v5, const cvar& v6, const cvar& v7, const cvar& v8, const cvar& v9, const cvar& v10, const cvar& v11, const cvar& v12, const cvar& v13, const cvar& v14) const;
cvar operator()(const cvar& v1, const cvar& v2, const cvar& v3, const cvar& v4, const cvar& v5, const cvar& v6, const cvar& v7, const cvar& v8, const cvar& v9, const cvar& v10, const cvar& v11, const cvar& v12, const cvar& v13, const cvar& v14, const cvar& v15) const;
Invokes a stored native Func0–Func15 callable with the matching argument count. A cfunc expression is data and must instead be evaluated by an interpreter or executor.
Returns the last vector element or function argument by reference; the sequence must be nonempty. Objects may implement the corresponding runtime operation.
cvar& front();
const cvar& front() const;
Returns the first vector element or function argument by reference; the sequence must be nonempty. Objects may implement the corresponding runtime operation.
Converts to an arithmetic type using as<T>(), following references and supported conversions. Unsupported categories throw CError; narrowing does not add a separate range check.
Provides checked borrowed access through as<cstr>(). It does not create a copy; the owning value and any followed references must remain valid.
operator const cstr&() const;
Provides checked borrowed access through as<cstr>(). It does not create a copy; the owning value and any followed references must remain valid.
Provides checked borrowed access through as<cvec>(). It does not create a copy; the owning value and any followed references must remain valid.
operator const cvec&() const;
Provides checked borrowed access through as<cvec>(). It does not create a copy; the owning value and any followed references must remain valid.
Provides checked borrowed access through as<cset>(). It does not create a copy; the owning value and any followed references must remain valid.
operator const cset&() const;
Provides checked borrowed access through as<cset>(). It does not create a copy; the owning value and any followed references must remain valid.
Provides checked borrowed access through as<cmap>(). It does not create a copy; the owning value and any followed references must remain valid.
operator const cmap&() const;
Provides checked borrowed access through as<cmap>(). It does not create a copy; the owning value and any followed references must remain valid.
Provides checked borrowed access through as<csym>(). It does not create a copy; the owning value and any followed references must remain valid.
operator const csym&() const;
Provides checked borrowed access through as<csym>(). It does not create a copy; the owning value and any followed references must remain valid.
Provides checked borrowed access through as<cfunc>(). It does not create a copy; the owning value and any followed references must remain valid.
operator const cfunc&() const;
Provides checked borrowed access through as<cfunc>(). It does not create a copy; the owning value and any followed references must remain valid.
Provides checked borrowed access through as<CBuffer>(). It does not create a copy; the owning value and any followed references must remain valid.
Provides checked borrowed access through as<CBuffer>(). It does not create a copy; the owning value and any followed references must remain valid.
Copies a stored vector into a numeric CPVector. The source must contain exactly N compatible elements; a size mismatch throws CError.
Converts through as<bool>(). Boolean conversion follows Catalyst’s accepted categories, not general string or collection truthiness.
Converts through as<int64_t>(). Unsupported value categories raise CError; numeric narrowing follows C++ conversion rules without an additional range check.
Converts through as<int32_t>(). Unsupported value categories raise CError; numeric narrowing follows C++ conversion rules without an additional range check.
Converts through as<int16_t>(). Unsupported value categories raise CError; numeric narrowing follows C++ conversion rules without an additional range check.
Converts through as<int8_t>(). Unsupported value categories raise CError; numeric narrowing follows C++ conversion rules without an additional range check.
Converts through as<size_t>(). Unsupported value categories raise CError; numeric narrowing follows C++ conversion rules without an additional range check.
Converts through as<uint64_t>(). Unsupported value categories raise CError; numeric narrowing follows C++ conversion rules without an additional range check.
Converts through as<uint32_t>(). Unsupported value categories raise CError; numeric narrowing follows C++ conversion rules without an additional range check.
Converts through as<uint16_t>(). Unsupported value categories raise CError; numeric narrowing follows C++ conversion rules without an additional range check.
Converts through as<uint8_t>(). Unsupported value categories raise CError; numeric narrowing follows C++ conversion rules without an additional range check.
Converts through as<float>(). Unsupported value categories raise CError; numeric narrowing follows C++ conversion rules without an additional range check.
Converts through as<double>(). Unsupported value categories raise CError; numeric narrowing follows C++ conversion rules without an additional range check.
Checked access through as<cstr>(), following references and applicable map # heads. The result is borrowed; it does not create an independent copy or owning handle.
Checked access through as<cvec>(), following references and applicable map # heads. The result is borrowed; it does not create an independent copy or owning handle.
Checked access through as<cset>(), following references and applicable map # heads. The result is borrowed; it does not create an independent copy or owning handle.
Checked access through as<cmap>(), following references and applicable map # heads. The result is borrowed; it does not create an independent copy or owning handle.
Checked access through as<csym>(), following references and applicable map # heads. The result is borrowed; it does not create an independent copy or owning handle.
Checked access through as<CBuffer>(), following references and applicable map # heads. The result is borrowed; it does not create an independent copy or owning handle.
Checked access through as<cfunc>(), following references and applicable map # heads. The result is borrowed; it does not create an independent copy or owning handle.
Checked access through as<CObject*>(), following references and applicable map # heads. The result is borrowed; it does not create an independent copy or owning handle.
bool getBool() const noexcept;
Direct access to the raw Bool payload. Establish the matching raw type first; this does not follow references or perform conversion, and returned references are borrowed.
int64_t& getInt() noexcept;
int64_t getInt() const noexcept;
Direct access to the raw Integer payload. Establish the matching raw type first; this does not follow references or perform conversion, and returned references are borrowed.
double& getFloat() noexcept;
double getFloat() const noexcept;
Direct access to the raw Float payload. Establish the matching raw type first; this does not follow references or perform conversion, and returned references are borrowed.
cstr& getStr() noexcept;
const cstr& getStr() const noexcept;
Direct access to the raw String payload. Establish the matching raw type first; this does not follow references or perform conversion, and returned references are borrowed.
cvec& getVec() noexcept;
const cvec& getVec() const noexcept;
Direct access to the raw Vector payload. Establish the matching raw type first; this does not follow references or perform conversion, and returned references are borrowed.
cset& getSet() noexcept;
const cset& getSet() const noexcept;
Direct access to the raw Set payload. Establish the matching raw type first; this does not follow references or perform conversion, and returned references are borrowed.
cmap& getMap() noexcept;
const cmap& getMap() const noexcept;
Direct access to the raw Map payload. Establish the matching raw type first; this does not follow references or perform conversion, and returned references are borrowed.
csym& getSym() noexcept;
const csym& getSym() const noexcept;
Direct access to the raw Symbol payload. Establish the matching raw type first; this does not follow references or perform conversion, and returned references are borrowed.
cfunc& getFunc() noexcept;
const cfunc& getFunc() const noexcept;
Direct access to the raw Function payload. Establish the matching raw type first; this does not follow references or perform conversion, and returned references are borrowed.
Direct access to the raw Buffer or Packed payload. Establish the matching raw type first; this does not follow references or perform conversion, and returned references are borrowed.
cvar& getRef() const noexcept;
Returns the borrowed referent of a value whose raw type is Reference. The caller must establish that type before calling; this accessor does not perform a checked conversion.
template<class T = void*> T getPtr() const;
Returns the stored native pointer cast to T. Requires the raw Pointer type and does not check the pointee’s dynamic type or transfer ownership.
template<class T = CObject*> T getObj() const;
Returns the stored object pointer cast to T. Requires the raw Object type; this static cast does not verify the dynamic class or add an owning reference.
bool isNull() const noexcept;
Tests whether the effective type is Null, following one stored reference. It does not perform a conversion or inspect a map’s head.
bool isNone() const noexcept;
Tests whether the effective type is None, following one stored reference. It does not perform a conversion or inspect a map’s head.
bool isBool() const noexcept;
Tests whether the effective type is Bool, following one stored reference. It does not perform a conversion or inspect a map’s head.
bool isInt() const noexcept;
Tests whether the effective type is Integer, following one stored reference. It does not perform a conversion or inspect a map’s head.
bool isFloat() const noexcept;
Tests whether the effective type is Float, following one stored reference. It does not perform a conversion or inspect a map’s head.
bool isStr() const noexcept;
Tests whether the effective type is String, following one stored reference. It does not perform a conversion or inspect a map’s head.
bool isVec() const noexcept;
Tests whether the effective type is Vector, following one stored reference. It does not perform a conversion or inspect a map’s head.
bool isSet() const noexcept;
Tests whether the effective type is Set, following one stored reference. It does not perform a conversion or inspect a map’s head.
bool isMap() const noexcept;
Tests whether the effective type is Map, following one stored reference. It does not perform a conversion or inspect a map’s head.
bool isBuf() const noexcept;
Reports whether the effective type is Buffer or Packed. Use isPacked() to distinguish compressed packed values.
bool isPtr() const noexcept;
Tests whether the effective type is Pointer, following one stored reference. It does not perform a conversion or inspect a map’s head.
bool isObj() const noexcept;
Tests whether the effective type is Object, following one stored reference. It does not perform a conversion or inspect a map’s head.
bool isSym() const noexcept;
template<CString T> bool isSym(T&& s) const;
Tests for a symbol, optionally matching its name. A named lookup uses the symbol’s cached hash, which must be refreshed after direct name changes.
bool isRef() const noexcept;
Tests the raw tag for an explicit reference. Other category predicates normally follow the reference first.
bool isFunc() const noexcept;
template<CString T> bool isFunc(T&& f) const;
template<CString T> bool isFunc(T&& f, size_t arity) const;
template<CString T> bool isFunc(T&& f, size_t minArity, size_t maxArity) const;
Tests for a function expression, optionally matching its name, exact arity, or inclusive arity range. Native Func0–Func15 callables are a different category.
bool isSymbolic() const noexcept;
Reports whether the effective value is a symbol or function expression. It does not evaluate that expression.
bool isNumeric() const noexcept;
Reports whether the effective type is Integer or Float. Bool and convertible strings are not classified as numeric.
bool isPacked() const noexcept;
Tests whether the effective type is Packed, following one stored reference. It does not perform a conversion or inspect a map’s head.
Counts vector elements, set elements, or function arguments, and forwards to objects and references. Other types, including strings and maps, return zero; use str().size() or map().size() for those.
Checks vectors, sets, and function arguments, forwarding to objects and references. Other types return true even when a contained string or map has contents.
cspan span() const;
cspan span(size_t start) const;
cspan span(size_t start, size_t endOffset) const;
Returns numeric indices rather than an element view.
Returns a map entry by reference without insertion. A missing key or incompatible value type raises CError; objects may supply the runtime at operation.
template<CString K> bool has(K&& k) const;
template<class K> requires(!CString<K>) bool has(K&& k) const;
Checks membership in a vector or set, or key presence in a map. Non-string keys are formatted for map lookup; unsupported ordinary value types return false.
template<CString K> void erase(K&& k);
void erase(const cvar& k);
template<class K> requires(!CString<K> && !CSame<K, cvar>) void erase(K&& k);
void erase(const cvar& first, const cvar& last);
Key overloads erase map/set entries. Iterator overloads erase sequence elements; use compatible iterators from the same live value.
Moves a map entry out and removes its key. The fallback overload returns its default when the key is missing.
void innerMerge(const cvar& v);
void innerMerge(const cmap& m);
The cvar overload recursively adds missing map entries while preserving existing leaves; maps containing # are left intact. The cmap overload merges immediate keys only.
void outerMerge(const cvar& v);
void outerMerge(const cmap& m);
The cvar overload recursively merges maps and replaces non-map leaves. Maps containing # are replaced as whole values; a plain target map is retained when the incoming value is not a map. The cmap overload merges immediate keys only.
Returns a runtime iterator represented by a cvar, suitable for interpreted traversal.
Returns the corresponding runtime end iterator.
Returns a runtime map iterator for a key.
cvec::iterator begin();
cvec::const_iterator begin() const;
Returns a C++ iterator over vector elements or function arguments. Map and set traversal require their typed container accessors or the runtime iterator API.
cvec::iterator end();
cvec::const_iterator end() const;
Returns the matching past-the-end iterator for vector elements or function arguments. It must be compared with iterators from the same live value.
chash hash(uint64_t seed = CHashDefaultSeed) const;
Computes the seeded value hash recursively. Map and set hashes do not depend on iteration order; numerically equal integral floats and integers share hashes.
chash64 hash64(uint64_t seed = CHashDefaultSeed) const;
Computes the 64-bit form of the seeded value hash. This is a hash of value content, not an identity or unique ID.
size_t memoryUsage() const;
Estimates the value’s recursively owned memory usage.
void pack(int compressLevel = -1);
Replaces the value with its compressed packed representation. A Buffer value is rejected; an already Packed value is unchanged.
Restores a Packed value. Other ordinary types are rejected.
void save(const cstr& path, int compressLevel = -1) const;
Stores the value in a file; use open() to restore it.
void open(const cstr& path);
Loads an archive written by save() and replaces this value. Checks the archive marker and decompresses the stored value.
Advances over one serialized value in a buffer without materializing it. The cursor must begin at that value’s type code.
static void skip_(CBuffer& b, uint8_t t);
Skips the payload for a type code already read by the caller. Prefer skip() when the buffer cursor is at the beginning of a serialized value.
Sends the supplied function node to the stored object’s CExecutor::execute() implementation. The receiver must resolve to an Object; this is not a general evaluator for a cfunc held in this value.
template<class T> void unite(T&& x);
Adds elements to a stored set using set union, or delegates to an object. Other ordinary value categories are rejected.
template<class T> void intersect(T&& x);
Retains only elements shared with the supplied set, or delegates to an object. The receiver is modified.
template<class T> void complement(T&& x);
Removes elements present in the supplied set, or delegates to an object. This is the receiver minus the argument.
Clears a string, vector, set, map, or function argument list while retaining its category. Objects can implement clear; other ordinary categories are rejected.
Removes and returns the last vector element, function argument, or string byte. A string returns a one-character string value; the sequence must be nonempty.
Removes and returns the first vector element, function argument, or string byte. A string returns a one-character string value; the sequence must be nonempty.
void append(const cvar& v);
Appends string text or sequence elements to the receiver, including a function’s argument vector. This appends the source contents; use operator<< to append a single nested value.
template<class T> void insert(size_t i, T&& x);
Inserts text, a vector element, or a function argument before a valid numeric position. Objects may implement the same operation.
Trims whitespace from both ends of a stored string in place. References forward the operation, and objects may implement it.
template<class T> cvar startsWith(T&& s);
Returns a boolean value indicating a stored string prefix match. References forward the operation, and objects may implement it.
template<class T> cvar endsWith(T&& s);
Returns a boolean value indicating a stored string suffix match. References forward the operation, and objects may implement it.
Splits a string on a nonempty delimiter and returns a vector of strings, retaining empty fields. References forward the operation, and objects may implement it.
cvar substr(size_t pos = 0, size_t n = cstr::npos);
Returns a byte substring of a stored string. The original string is unchanged; a start beyond its end raises CError.
cvar findReplace(const cstr& value, const cstr& replacement, bool all = true);
Replaces string matches in place and returns their count as a cvar. all = false changes only the first occurrence; the search string must be nonempty.
void replace(size_t pos, size_t n, const cstr& s);
Replaces n string bytes at pos with the supplied text. The replacement can change the string length.
Converts all characters in place; toAllUpper() returns a converted copy. Requires a String value or a reference to one.
Converts all characters in place; toAllLower() returns a converted copy. Requires a String value or a reference to one.
Converts the first character in place; toUpper() returns a converted copy. The string must be nonempty. Requires a String value or a reference to one.
Converts the first character in place; toLower() returns a converted copy. The string must be nonempty. Requires a String value or a reference to one.
Returns a copy with all characters converted to uppercase using the C character-conversion rules. This is not Unicode case conversion. Requires a String value or a reference to one.
Returns a copy with all characters converted to lowercase using the C character-conversion rules. This is not Unicode case conversion. Requires a String value or a reference to one.
Returns a copy with only the first character uppercased; the string must be nonempty. Requires a String value or a reference to one.
Returns a copy with only the first character lowercased; the string must be nonempty. Requires a String value or a reference to one.
Changes a string’s byte length, vector size, or function argument count. Objects may implement this operation; changing function arity requires a later rehash().
Requests capacity for a string, vector, or function argument list without changing its logical size. Existing references can be invalidated if storage grows.
template<class T> size_t indexOf(T&& x) const;
Returns the index of the first equal vector element or function argument, or its size when absent. Objects may implement their own index lookup.
Scans a map for an equal value and returns the first corresponding key in iteration order. Raises CError when no value matches.
Returns a new vector of a map’s keys. Objects may implement the runtime keys operation.
template<class T> static cvar wrap(T&& value, uint16_t kind);
Owns a native value in an object wrapper and assigns the supplied kind code. Copies share the wrapped object; native wrappers are not a portable storage or binding format.
template<class T> T& unwrap(const cstr& name) const;
Returns the native value after checking its C++ wrapper type. name supplies the expected-type text in an error message.
template<CString T, class... Args> static CObject* construct(T&& object, Args&&... args);
Constructs a registered runtime object using its class name and arguments.
template<class T> bool operator==(T&& x) const;
template<CNumeric T> friend bool operator==(T x, const cvar& v);
Performs dynamic equality comparison and returns a C++ boolean. Numeric types compare by numeric value, collections compare by their contents, and unlike ordinary categories use type ordering; object comparisons dispatch to the object.
template<class T> cvar EQ(T&& x) const;
Performs the corresponding dynamic comparison and returns a cvar. Unlike the C++ boolean operator, comparisons involving None and most ordinary values can propagate None instead of returning false.
template<class T> bool operator!=(T&& x) const;
template<CNumeric T> friend bool operator!=(T x, const cvar& v);
Performs dynamic inequality comparison and returns a C++ boolean. Numeric types compare by numeric value, collections compare by their contents, and unlike ordinary categories use type ordering; object comparisons dispatch to the object.
template<class T> cvar NE(T&& x) const;
Performs the corresponding dynamic comparison and returns a cvar. Unlike the C++ boolean operator, comparisons involving None and most ordinary values can propagate None instead of returning false.
template<class T> bool operator<(T&& x) const;
template<CNumeric T> friend bool operator<(T x, const cvar& v);
Performs dynamic less-than comparison and returns a C++ boolean. Numeric types compare by numeric value, collections compare by their contents, and unlike ordinary categories use type ordering; object comparisons dispatch to the object.
template<class T> cvar LT(T&& x) const;
Performs the corresponding dynamic comparison and returns a cvar. Unlike the C++ boolean operator, comparisons involving None and most ordinary values can propagate None instead of returning false.
template<class T> bool operator>(T&& x) const;
template<CNumeric T> friend bool operator>(T x, const cvar& v);
Performs dynamic greater-than comparison and returns a C++ boolean. Numeric types compare by numeric value, collections compare by their contents, and unlike ordinary categories use type ordering; object comparisons dispatch to the object.
template<class T> cvar GT(T&& x) const;
Performs the corresponding dynamic comparison and returns a cvar. Unlike the C++ boolean operator, comparisons involving None and most ordinary values can propagate None instead of returning false.
template<class T> bool operator<=(T&& x) const;
template<CNumeric T> friend bool operator<=(T x, const cvar& v);
Performs dynamic less-or-equal comparison and returns a C++ boolean. Numeric types compare by numeric value, collections compare by their contents, and unlike ordinary categories use type ordering; object comparisons dispatch to the object.
template<class T> cvar LE(T&& x) const;
Performs the corresponding dynamic comparison and returns a cvar. Unlike the C++ boolean operator, comparisons involving None and most ordinary values can propagate None instead of returning false.
template<class T> bool operator>=(T&& x) const;
template<CNumeric T> friend bool operator>=(T x, const cvar& v);
Performs dynamic greater-or-equal comparison and returns a C++ boolean. Numeric types compare by numeric value, collections compare by their contents, and unlike ordinary categories use type ordering; object comparisons dispatch to the object.
template<class T> cvar GE(T&& x) const;
Performs the corresponding dynamic comparison and returns a cvar. Unlike the C++ boolean operator, comparisons involving None and most ordinary values can propagate None instead of returning false.
template<class T> cvar operator+(T&& x) const;
template<CNumeric T> friend cvar operator+(T x, const cvar& v);
friend cstr operator+(const char* s, const cvar& v);
Performs dynamic add arithmetic on numeric values or component-wise on compatible vectors. Unsupported operands raise CError; vector sizes must be compatible. Two string values concatenate.
template<class T> cvar operator-(T&& x) const;
cvar operator-() const;
template<CNumeric T> friend cvar operator-(T x, const cvar& v);
Performs dynamic sub arithmetic on numeric values or component-wise on compatible vectors. Unsupported operands raise CError; vector sizes must be compatible. The unary overload negates numeric values.
template<class T> cvar operator/(T&& x) const;
template<CNumeric T> friend cvar operator/(T x, const cvar& v);
Performs dynamic div arithmetic on numeric values or component-wise on compatible vectors. Unsupported operands raise CError; vector sizes must be compatible. Integral division truncates; use Div() for explicit zero-divisor checking.
template<class T> cvar Div(T&& x) const;
Divides using dynamic numeric/vector dispatch while explicitly checking for a zero divisor and raising CError. Integral division retains integer division semantics.
template<class T> cvar operator%(T&& x) const;
template<CNumeric T> friend cvar operator%(T x, const cvar& v);
Performs dynamic mod arithmetic on numeric values or component-wise on compatible vectors. Unsupported operands raise CError; vector sizes must be compatible. Floating-point remainder uses std::fmod.
template<class T> cvar& operator+=(T&& x);
template<CNumeric T> friend T& operator+=(T& x, const cvar& v);
Applies dynamic add arithmetic in place and returns this value. References modify their referent; compatible vectors are updated component by component.
template<class T> cvar& operator-=(T&& x);
template<CNumeric T> friend T& operator-=(T& x, const cvar& v);
Applies dynamic sub arithmetic in place and returns this value. References modify their referent; compatible vectors are updated component by component.
template<class T> cvar& operator*=(T&& x);
template<CNumeric T> friend T& operator*=(T& x, const cvar& v);
Applies dynamic mul arithmetic in place and returns this value. References modify their referent; compatible vectors are updated component by component.
template<class T> cvar& operator/=(T&& x);
template<CNumeric T> friend T& operator/=(T& x, const cvar& v);
Applies dynamic div arithmetic in place and returns this value. References modify their referent; compatible vectors are updated component by component.
template<class T> cvar& DivBy(T&& x);
Applies checked division to this value in place and returns it. A zero divisor raises CError.
template<class T> cvar& operator%=(T&& x);
template<CNumeric T> friend T& operator%=(T& x, const cvar& v);
Applies dynamic mod arithmetic in place and returns this value. References modify their referent; compatible vectors are updated component by component.
Applies dynamic negation: None remains None, Null becomes true, and integers compare with zero. References forward, maps negate their # head, and objects dispatch Not; unsupported categories such as Float and String throw CError.
cvar operator++(int);
cvar& operator++();
Increments an Integer or Float in place, forwarding through a reference. Prefix returns the updated receiver and postfix returns the old value; objects dispatch Inc or PostInc.
cvar operator--(int);
cvar& operator--();
Decrements an Integer or Float in place, forwarding through a reference. Prefix returns the updated receiver and postfix returns the old value; objects dispatch Dec or PostDec.