Skip to content

Latest commit

 

History

History
27 lines (23 loc) · 701 Bytes

example0.md

File metadata and controls

27 lines (23 loc) · 701 Bytes

ThorStream

    #include <iostream>
    #include <vector>
    #include "ThorSerialize/JsonThor.h"

    int main()
    {
        std::vector<int>    data;
        using ThorsAnvil::Serialize::jsonImporter;
        using ThorsAnvil::Serialize::jsonExporter;

        std::cin >> jsonImporter(data);
        std::cout << jsonExporter(data) << "\n";
    }

Build and run

    > g++ -std=c++20 example0.cpp -lThorSerialize -lThorsLogging
    > # Note on mac you may need to add -I/opt/homebrew/include -L/opt/homebrew/lib/ on Mac's with M1 chip.
    > echo "[1,2,3,4,5]" | ./a.out
    [1, 2, 3, 4, 5]
    >