TRIQS/h5 1.3.0
C++ interface to HDF5
|
Specialized functions to read/write a std::variant from/to HDF5.
The following code writes a std::variant to an HDF5 file, reads the same variant and outputs it to stdout:
Output:
Contents of variant.h5
:
Classes | |
struct | h5::hdf5_format_impl< std::variant< T... > > |
Specialization of h5::hdf5_format_impl for std::variant. More... | |
Functions | |
template<typename... Ts> | |
void | h5::h5_read (group g, std::string const &name, std::variant< Ts... > &v) |
Read a std::variant from an HDF5 dataset. | |
template<typename... Ts> | |
void | h5::h5_write (group g, std::string const &name, std::variant< Ts... > const &v) |
Write a std::variant to an HDF5 dataset/subgroup. | |
void h5::h5_read | ( | group | g, |
std::string const & | name, | ||
std::variant< Ts... > & | v ) |
#include <h5/stl/variant.hpp>
Read a std::variant from an HDF5 dataset.
h5_read
.Ts | Variant types. |
g | h5::group containing the dataset. |
name | Name of the dataset from which the std::variant is read. |
v | std::variant to read into. |
Definition at line 92 of file variant.hpp.
void h5::h5_write | ( | group | g, |
std::string const & | name, | ||
std::variant< Ts... > const & | v ) |
#include <h5/stl/variant.hpp>
Write a std::variant to an HDF5 dataset/subgroup.
Calls the specialized h5_write
for the type currently stored in the std::variant.
Ts | Variant types. |
g | h5::group in which the dataset/subgroup is created. |
name | Name of the dataset/subgroup to which the std::variant is written. |
v | std::variant to be written. |
Definition at line 58 of file variant.hpp.