Build error serializing struct to XML using Boost

I’m trying to serialize some structs to XML using Boost. I can’t change the structs, so I’m trying to do it non invasively. Following the simple "non intrusive version" example in the docs I managed to get flat text serialization to work. However when I try to extend it to XML by looking at the… Read More Build error serializing struct to XML using Boost

Using boost::recursive_variant with std::unordered_map

I’m trying to create a std::unordered_map with a boost::variant as a key and with integer value. What I’m trying to make work is this: #include <boost/variant.hpp> #include <unordered_map> #include <string> enum Token {}; struct AssignExpr; struct LiteralExpr; using Expr = boost::variant<boost::blank, boost::recursive_wrapper<AssignExpr>, boost::recursive_wrapper<LiteralExpr>>; using Literal = int; struct LiteralExpr { Literal literal; explicit LiteralExpr(const Literal… Read More Using boost::recursive_variant with std::unordered_map

Inherit from boost::matrix

I would like to inherit from boost::matrix to enrich with some methods. I started with this : #include <boost/numeric/ublas/matrix.hpp> using namespace boost::numeric::ublas; class MyMatrix : public matrix<double> { public: MyMatrix() : matrix<double>(0, 0) {} MyMatrix(int size1, int size2) : matrix<double>(size1, size2) {} MyMatrix(MyMatrix& mat) : matrix<double>(mat) {} MyMatrix(matrix<double>& mat) : matrix<double>(mat) {} MyMatrix& operator=(const MyMatrix&… Read More Inherit from boost::matrix

Parse elements from json array using boost

here is the json I want to parse: {"jsonrpc":"2.0","method":"subscription","params":{"channel":"book.BTC-PERPETUAL.raw","data":{"type":"change","timestamp":1635513739435,"prev_change_id":6807100702,"instrument_name":"BTC-PERPETUAL","change_id":6807100703,"bids":[["new",60772.0,50.0], "demo"],"asks":[]}}} and here is my code to get the values from a child: boost::property_tree::ptree pt; boost::property_tree::read_json(ss, pt); std::cout << "\njsonrpc: " << pt.get<std::string>("jsonrpc") << std::endl; std::cout << "\nmethod: " << pt.get<std::string>("method") << std::endl; std::cout << "\nparams: " << pt.get<std::string>("params") << std::endl; std::cout << "\nparams.channel: " <<… Read More Parse elements from json array using boost