Cbeam
Loading...
Searching...
No Matches
cbeam::container::xpod Namespace Reference

Provides a specialized variant type (xpod::type) for simple data exchange, supporting integer, floating-point, boolean, pointers, and strings. This namespace is designed for compactness and serializability, letting you store fundamental data types in a variant structure. By including additional headers, the variant gains transparent serialization capabilities without sacrificing performance. More...

Namespaces

namespace  type_index
 Defines index constants for the xpod::type variant (e.g., integer, number, boolean, pointer, string). These constants allow you to refer to a specific type index in the underlying variant, simplifying code that checks or extracts a particular xpod type.
 

Typedefs

using type = std::variant<long long, double, bool, memory::pointer, std::string>
 A variant designed for basic data types. memory::pointer is used in place of void* to provide additional features.
 

Functions

std::ostream & operator<< (std::ostream &os, const xpod::type &v)
 Overload of the insertion operator to output the contents of an xpod::type.
 

Detailed Description

Provides a specialized variant type (xpod::type) for simple data exchange, supporting integer, floating-point, boolean, pointers, and strings. This namespace is designed for compactness and serializability, letting you store fundamental data types in a variant structure. By including additional headers, the variant gains transparent serialization capabilities without sacrificing performance.

Typedef Documentation

◆ type

using cbeam::container::xpod::type = std::variant<long long, double, bool, memory::pointer, std::string>

A variant designed for basic data types. memory::pointer is used in place of void* to provide additional features.

By including the header 'serialization/xpod.hpp', this variant gains serialization capabilities. This functionality is the primary reason for using memory::pointer instead of raw void*. Thanks to its serializability, it can be used as key and value types in cbeam::container::nested_map (which gains serialization capabilities by including 'serialization/nested_map.hpp').

Function Documentation

◆ operator<<()

std::ostream & cbeam::container::xpod::operator<< ( std::ostream & os,
const xpod::type & v )
inline

Overload of the insertion operator to output the contents of an xpod::type.

This uses std::visit to print the currently active variant type in a human-readable way.

Parameters
osThe output stream.
vThe xpod::type variant to print.
Returns
std::ostream& A reference to the output stream for chaining.