13 template <
class CONTAINER>
16 for (
const auto& e : m) std::cout << e.first <<
"=" << e.second <<
", ";
17 std::cout << std::endl;
31 std::map<std::string, uint32_t> m1{{
"one", 1}, {
"two", 2}};
43 std::map<std::string, uint32_t> m2;
52 std::cout <<
"Wrote: ";
54 std::cout <<
"Read : ";
70 std::map<std::string, uint32_t> m1{{
"one", 1}, {
"two", 2}};
75 std::ofstream ofs(
"file.bin");
76 auto arch_out = mrpt::serialization::archiveFrom<std::ostream>(ofs);
82 std::map<std::string, uint32_t> m2;
85 std::ifstream ifs(
"file.bin");
86 auto arch_in = mrpt::serialization::archiveFrom<std::istream>(ifs);
91 std::cout <<
"Wrote: ";
93 std::cout <<
"Read : ";
109 catch (
const std::exception& e)
116 printf(
"Untyped exception!");
CArchiveStreamBase< STREAM > archiveFrom(STREAM &s)
Helper function to create a templatized wrapper CArchive object for a: MRPT's CStream, std::istream, std::ostream, std::stringstream.
void WriteAndReadExampleStdIO()
[example]
void WriteAndReadExample()
[example]
This CStream derived class allow using a file as a write-only, binary stream.
std::string exception_to_str(const std::exception &e)
Builds a nice textual representation of a nested exception, which if generated using MRPT macros (THR...
void printMap(const CONTAINER &m)