Add comment to filenames in boostTest.cpp

This commit is contained in:
Jason Cobb 2020-05-12 10:39:00 -04:00
parent 899e6d7e2b
commit 63ad1092cd
No known key found for this signature in database
GPG Key ID: 2A3F6A6DCA1E8DED

View File

@ -89,7 +89,10 @@ int registerTests(
}
else
{
static vector<unique_ptr<string>> filenames;
// This must be a vector of unique_ptrs because Boost.Test keeps the equivalent of a string_view to the filename
// that is passed in. If the strings were stored directly in the vector, pointers/references to them would be
// invalidated on reallocation.
static vector<unique_ptr<string const>> filenames;
filenames.emplace_back(make_unique<string>(_path.string()));
_suite.add(make_test_case(