Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <yas/binary_iarchive.hpp>
- #include <yas/binary_oarchive.hpp>
- #include <yas/serializers/binary/std/std_unordered_map_serializers.hpp>
- #include <cassert>
- #include <iostream>
- /***************************************************************************/
- int main() {
- using map_type = std::unordered_map<int, int>;
- enum {
- k1 = 1
- ,v1 = 2
- ,k2 = 3
- ,v2 = 4
- ,size = 2
- };
- map_type omap = {
- {k1, v1}
- ,{k2, v2}
- };
- yas::binary_mem_oarchive oa;
- oa & omap;
- map_type imap;
- yas::binary_mem_iarchive ia(oa.get_intrusive_buffer());
- ia & imap;
- assert(imap.size() == size);
- assert(imap.find(k1) != imap.end() && imap.at(k1) == v1);
- assert(imap.find(k2) != imap.end() && imap.at(k2) == v2);
- return 0;
- }
- /***************************************************************************/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement