23#ifndef VCL_BASE_SERIALIZATION_STL_SERIALIZE_H
24#define VCL_BASE_SERIALIZATION_STL_SERIALIZE_H
32#include <unordered_map>
43inline void serialize(std::ostream& os,
const std::string& s)
45 std::size_t size = s.
size();
47 serializeN(os, s.data(), size);
54template<
typename T, std::
size_t N>
55void serialize(std::ostream& os,
const std::array<T, N>& a)
57 if constexpr (Serializable<T>) {
58 for (
const T& v : a) {
63 for (
const T& e : a) {
73template<
typename K,
typename V>
74void serialize(std::ostream& os,
const std::map<K, V>& m)
76 std::size_t size = m.
size();
78 for (
const auto& [key, value] : m) {
79 if constexpr (Serializable<K>) {
85 if constexpr (Serializable<V>) {
98template<
typename K,
typename V>
99void serialize(std::ostream& os,
const std::unordered_map<K, V>& m)
101 std::size_t size = m.
size();
103 for (
const auto& [key, value] : m) {
104 if constexpr (Serializable<K>) {
110 if constexpr (Serializable<V>) {
114 serialize(os, value);
124void serialize(std::ostream& os,
const std::vector<T>& v)
126 std::size_t size = v.
size();
128 if constexpr (Serializable<T>) {
129 for (
const T& e : v) {
134 for (
const T& e : v) {
141void serialize(std::ostream& os,
const std::vector<std::any>& v)
143 std::size_t size = v.
size();
145 if constexpr (Serializable<T>) {
146 for (
const std::any& e : v) {
147 std::any_cast<T>(e).serialize(os);
151 for (
const std::any& e : v) {
152 serialize(os, std::any_cast<T>(e));
void serialize(std::ostream &os) const
Serializes the box to the given output stream.
Definition box.h:466
PointT size() const
Computes the size of the box.
Definition box.h:267