Add an assert to confirm that try_emplace is inserting a new entry

This commit is contained in:
A.J. Beamon 2021-06-03 13:51:47 -07:00
parent 7d83340993
commit 24d17c013b
1 changed files with 5 additions and 1 deletions

View File

@ -147,7 +147,11 @@ public:
if (f.isReady() && f.isError())
return f;
itr = openFiles.try_emplace(filename, f).first;
auto result = openFiles.try_emplace(filename, f);
// This should be inserting a new entry
ASSERT(result.second);
itr = result.first;
// We return here instead of falling through to the outer scope so that we don't delete all references to
// the underlying file before returning