I have some code that I have written where it will likely create a dynamic amount of pointers of various datatypes to be stored in an std::unordered_map. I would like to use shared_ptr<void> so that I only need one map with types <std::string, std::shared_ptr<void>> so that when the map gets deleted, all pointers are deleted properly. If I store pointers in this map using shared_ptr<void> dat = make_shared<int>(some_value) and then another for example like shared_ptr<void> dat = make_shared<char>(some_value), will these be deleted properly or will this result in undefined behaviour by calling delete on a void*?
Asked
Active
Viewed 19 times
0
seandburke99
- 29
- 3