MCPcopy Create free account
hub / github.com/danielaparker/jsoncons / boost_date_conversions

Function boost_date_conversions

examples_boost/extensibility.cpp:184–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182using boost::numeric::ublas::matrix;
183
184void boost_date_conversions()
185{
186 using boost::gregorian::date;
187
188 json deal;
189 deal["maturity"] = date(2014,10,14);
190
191 json observation_dates(json_array_arg);
192 observation_dates.push_back(date(2014,2,14));
193 observation_dates.push_back(date(2014,2,21));
194
195 deal["observationDates"] = std::move(observation_dates);
196
197 date maturity = deal["maturity"].as<date>();
198
199 assert(deal["maturity"].as<date>() == date(2014,10,14));
200 assert(deal["observationDates"].is_array());
201 assert(deal["observationDates"].size() == 2);
202 assert(deal["observationDates"][0].as<date>() == date(2014,2,14));
203 assert(deal["observationDates"][1].as<date>() == date(2014,2,21));
204
205 std::cout << pretty_print(deal) << '\n';
206}
207
208void boost_matrix_conversions()
209{

Callers 1

extensibility_examplesFunction · 0.85

Calls 4

pretty_printFunction · 0.85
push_backMethod · 0.45
is_arrayMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected