23#ifndef VCL_BASE_SERIALIZATION_SERIALIZE_H
24#define VCL_BASE_SERIALIZATION_SERIALIZE_H
28#include <vclib/base/concepts/serialization.h>
29#include <vclib/base/concepts/types.h>
47void serialize(std::ostream& os,
const T& data, std::endian endian)
49 if (endian != std::endian::native) {
50 T swapped = detail::swapEndian(data);
51 os.write(
reinterpret_cast<const char*
>(&swapped),
sizeof(T));
54 os.write(
reinterpret_cast<const char*
>(&data),
sizeof(T));
77 std::endian endian = std::endian::little)
79 for (std::size_t i = 0; i < size; ++i) {
80 serialize(os, data[i], endian);
84template<
typename T,
typename... Others>
85void serialize(std::ostream& os,
const T& data,
const Others&... others)
87 if constexpr (Serializable<T>) {
91 serialize(os, data, std::endian::little);
93 if constexpr (
sizeof...(Others) > 0) {
94 serialize(os, others...);
void serialize(std::ostream &os) const
Serializes the box to the given output stream.
Definition box.h:466