Container System 0.1.0
High-performance C++20 type-safe container framework with SIMD-accelerated serialization
Loading...
Searching...
No Matches
kcenon::container::array_variant Struct Reference

Recursive array type for variant. More...

#include <value.h>

Collaboration diagram for kcenon::container::array_variant:
Collaboration graph

Public Member Functions

 array_variant ()=default
 
 array_variant (const array_variant &other)
 
 array_variant (array_variant &&other) noexcept=default
 
array_variantoperator= (const array_variant &other)
 
array_variantoperator= (array_variant &&other) noexcept=default
 
bool operator== (const array_variant &other) const
 
bool operator!= (const array_variant &other) const
 
bool operator< (const array_variant &other) const
 

Public Attributes

std::vector< std::shared_ptr< value > > values
 

Detailed Description

Recursive array type for variant.

array_value (type 15) stores heterogeneous collections. Uses vector of value for type safety.

Definition at line 45 of file value.h.

Constructor & Destructor Documentation

◆ array_variant() [1/3]

kcenon::container::array_variant::array_variant ( )
default

◆ array_variant() [2/3]

kcenon::container::array_variant::array_variant ( const array_variant & other)

Definition at line 47 of file value.cpp.

47 {
48 values.reserve(other.values.size());
49 for (const auto& val : other.values) {
50 if (val) {
51 values.push_back(std::make_shared<value>(*val));
52 }
53 }
54 }
std::vector< std::shared_ptr< value > > values
Definition value.h:46

References values.

◆ array_variant() [3/3]

kcenon::container::array_variant::array_variant ( array_variant && other)
defaultnoexcept

Member Function Documentation

◆ operator!=()

bool kcenon::container::array_variant::operator!= ( const array_variant & other) const
inline

Definition at line 55 of file value.h.

55{ return !(*this == other); }

◆ operator<()

bool kcenon::container::array_variant::operator< ( const array_variant & other) const

Definition at line 79 of file value.cpp.

79 {
80 return values.size() < other.values.size();
81 }

References values.

◆ operator=() [1/2]

array_variant & kcenon::container::array_variant::operator= ( array_variant && other)
defaultnoexcept

◆ operator=() [2/2]

array_variant & kcenon::container::array_variant::operator= ( const array_variant & other)

Definition at line 56 of file value.cpp.

56 {
57 if (this != &other) {
58 values.clear();
59 values.reserve(other.values.size());
60 for (const auto& val : other.values) {
61 if (val) {
62 values.push_back(std::make_shared<value>(*val));
63 }
64 }
65 }
66 return *this;
67 }

References values.

◆ operator==()

bool kcenon::container::array_variant::operator== ( const array_variant & other) const

Definition at line 69 of file value.cpp.

69 {
70 if (values.size() != other.values.size()) return false;
71 for (size_t i = 0; i < values.size(); ++i) {
72 if (!values[i] && !other.values[i]) continue;
73 if (!values[i] || !other.values[i]) return false;
74 if (*values[i] != *other.values[i]) return false;
75 }
76 return true;
77 }

References values.

Member Data Documentation

◆ values

std::vector<std::shared_ptr<value> > kcenon::container::array_variant::values

The documentation for this struct was generated from the following files: