19 #ifndef USER_DATA_CARRIER_H
20 #define USER_DATA_CARRIER_H
22 #include <unordered_map>
34 std::runtime_error(what) {}
42 void stash(T thing,
const std::string& identifier) {
46 bool exists(
const std::string& identifier)
const {
47 return things_.count(identifier);
51 T get(
const std::string& identifier)
const {
52 if(!exists(identifier)) {
55 return smlt::any_cast<T>(things_.at(identifier));
58 void unstash(
const std::string& identifier) {
59 if(!exists(identifier))
return;
61 things_.erase(identifier);
65 std::unordered_map<std::string, smlt::any> things_;
71 #endif // USER_DATA_CARRIER_H