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

Function cbor_example

examples/src/json_traits_bitset_examples.cpp:28–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28void cbor_example()
29{
30 std::bitset<8> bs1(42);
31
32 std::vector<uint8_t> data;
33 cbor::encode_cbor(bs1, data);
34 std::cout << byte_string_view(data) << "\n\n";
35 /*
36 0xd7, // Expected conversion to base16
37 0x41, // Byte string value of length 1
38 0x54
39 */
40
41 auto bs2 = cbor::decode_cbor<std::bitset<8>>(data);
42
43 assert(bs2 == bs1);
44}
45
46int main()
47{

Callers 1

mainFunction · 0.85

Calls 2

encode_cborFunction · 0.85
byte_string_viewClass · 0.85

Tested by

no test coverage detected