Skip to content

Instantly share code, notes, and snippets.

@HappyCerberus
Created December 7, 2022 12:10
Show Gist options
  • Save HappyCerberus/38d5aed6d2163f5d302d45d3d395e0ed to your computer and use it in GitHub Desktop.
Save HappyCerberus/38d5aed6d2163f5d302d45d3d395e0ed to your computer and use it in GitHub Desktop.
struct Directory {
// Required for "$ cd ..".
Directory *parent = nullptr;
// Required for "$ cd subdirectory".
std::unordered_map<std::string, Directory*> subdirs;
// Information about files.
std::unordered_map<std::string, size_t> files;
};
struct Tree {
// Directory root.
Directory root;
// Storage for all Directories.
std::vector<std::unique_ptr<Directory>> storage;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment