#include <h5cpp/all>
#include <iostream>
#include <set>
#include <string>
#include <unordered_set>
#include <vector>
#include <algorithm>
template <class C>
static bool same_multiset(const C& a, const C& b) {
if (a.size() != b.size()) return false;
return as == bs;
}
int main() {
auto check = [](const char* label, bool ok) {
std::cout << (ok ?
"✔ ok " :
"✘ failed") <<
" " << label <<
"\n";
};
{
std::cout <<
" set<int>(5) = " << back <<
"\n";
check("std::set<int> round-trip", back == s);
}
{
std::cout <<
" multiset<int>(9) = " << back <<
"\n";
check("std::multiset<int> round-trip", back == m);
}
{
std::cout <<
" unordered_set<int>(6) = " << back <<
"\n";
check("std::unordered_set<int> round-trip (multiset cmp)", same_multiset(u, back));
}
{
h5::write(fd,
"/sets/unordered_multiset_int", um);
std::cout <<
" u_multiset<int>(8) = " << back <<
"\n";
check("std::unordered_multiset<int> round-trip (multiset cmp)", same_multiset(um, back));
}
return 0;
}
h5::at_t create(const hid_t &parent, const std::string &path, args_t &&... args)
Create a new attribute of element type T on a parent HDF5 object.
Definition H5Acreate.hpp:100
T aread(const hid_t &ds, const std::string &name, const h5::acpl_t &acpl=h5::default_acpl)
Read an attribute by name and return its value as type T.
Definition H5Aread.hpp:76
h5::gr_t write(const LOC &parent, const std::string &path, const T &src)
Write a sparse matrix or vector as a CSC group.
Definition H5Dsparse.hpp:185