File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 2121#include < sstream>
2222#include < cassert>
2323
24- # if 0 // When you want to adapt map instead of array, you can enable these macro definition.
25- #define MSGPACK_USE_DEFINE_MAP
26- #define MSGPACK_USE_BOOST
27- # endif
24+ // When you want to adapt map instead of array, you can enable these macro definition.
25+ //
26+ // #define MSGPACK_USE_DEFINE_MAP
27+
2828
2929#include < msgpack.hpp>
3030
@@ -100,6 +100,7 @@ int main() {
100100 }
101101 { // create object with zone
102102 my_class my (" John Smith" , 42 );
103+ my.a = 123 ;
103104 my.set_b (" ABC" );
104105 my.set_c (" DEF" );
105106 msgpack::zone z;
Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ class my_class {
2828public:
2929 my_class () {} // When you want to convert from msgpack::object to my_class,
3030 // my_class should be default constractible.
31+ // If you use C++11, you can adapt non-default constructible
32+ // classes to msgpack::object.
33+ // See https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_adaptor#non-default-constructible-class-support-c11-only
3134 my_class (std::string const & name, int age):name_(name), age_(age) {}
3235
3336 friend bool operator ==(my_class const & lhs, my_class const & rhs) {
@@ -39,7 +42,7 @@ class my_class {
3942 int age_;
4043
4144public:
42- MSGPACK_DEFINE (name_, age_);
45+ MSGPACK_DEFINE_MAP (name_, age_);
4346};
4447
4548void print (std::string const & buf) {
You can’t perform that action at this time.
0 commit comments