Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ThorSerialize/YamlThor.h"
- #include "ThorSerialize/SerUtil.h"
- #include <iostream>
- #include <vector>
- struct InventoryItem {
- std::string name;
- int baseValue;
- float weight;
- };
- ThorsAnvil_MakeTrait(InventoryItem, name, baseValue, weight);
- struct Inventory {
- float maximumWeight;
- std::vector<InventoryItem> items;
- };
- ThorsAnvil_MakeTrait(Inventory, maximumWeight, items);
- int main()
- {
- InventoryItem car {"Audi", 1000000, 12.45};
- InventoryItem bike{"pedal", 10, 2.32};
- InventoryItem bus {"Big Red", 6789, 45.001};
- Inventory inventory{200, {car, bike, bus}};
- std::cout << ThorsAnvil::Serialize::yamlExport(inventory);
- }
Add Comment
Please, Sign In to add comment