Skip to content

Commit ce54f47

Browse files
committed
Fix: captured structured bindings are a C++20 extension
1 parent f19676c commit ce54f47

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

src/IO/HDF5/HDF5IOHandler.cpp

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -954,25 +954,27 @@ void HDF5IOHandlerImpl::createDataset(
954954
{
955955
if (chunking->size() != parameters.extent.size())
956956
{
957-
std::string chunking_printed = [&]() {
958-
if (chunking->empty())
959-
{
960-
return std::string("[]");
961-
}
962-
else
963-
{
964-
std::stringstream s;
965-
auto it = chunking->begin();
966-
auto end = chunking->end();
967-
s << '[' << *it++;
968-
for (; it != end; ++it)
957+
// captured structured bindings are a C++20 extension
958+
std::string chunking_printed =
959+
[&, &captured_chunking = chunking]() {
960+
if (captured_chunking->empty())
969961
{
970-
s << ", " << *it;
962+
return std::string("[]");
971963
}
972-
s << ']';
973-
return s.str();
974-
}
975-
}();
964+
else
965+
{
966+
std::stringstream s;
967+
auto it = captured_chunking->begin();
968+
auto end = captured_chunking->end();
969+
s << '[' << *it++;
970+
for (; it != end; ++it)
971+
{
972+
s << ", " << *it;
973+
}
974+
s << ']';
975+
return s.str();
976+
}
977+
}();
976978
std::cerr << "[HDF5] Chunking for dataset '" << name
977979
<< "' was specified as " << chunking_printed
978980
<< ", but dataset has dimensionality "

0 commit comments

Comments
 (0)