Added workaround for MSVC limitation on number of consecutive loops
parent
0b08923c41
commit
bcad0b661c
|
@ -558,13 +558,15 @@ void Module::WriteCollectorsAndCleanupFcn(FileWriter& wrapperFile, const std::st
|
||||||
const string cppName = cls.qualifiedName("::");
|
const string cppName = cls.qualifiedName("::");
|
||||||
const string collectorType = "Collector_" + matlabUniqueName;
|
const string collectorType = "Collector_" + matlabUniqueName;
|
||||||
const string collectorName = "collector_" + matlabUniqueName;
|
const string collectorName = "collector_" + matlabUniqueName;
|
||||||
|
// The extra curly-braces around the for loops work around a limitation in MSVC (existing
|
||||||
|
// since 2005!) preventing more than 248 blocks.
|
||||||
wrapperFile.oss <<
|
wrapperFile.oss <<
|
||||||
" for(" << collectorType << "::iterator iter = " << collectorName << ".begin();\n"
|
" { for(" << collectorType << "::iterator iter = " << collectorName << ".begin();\n"
|
||||||
" iter != " << collectorName << ".end(); ) {\n"
|
" iter != " << collectorName << ".end(); ) {\n"
|
||||||
" delete *iter;\n"
|
" delete *iter;\n"
|
||||||
" " << collectorName << ".erase(iter++);\n"
|
" " << collectorName << ".erase(iter++);\n"
|
||||||
" anyDeleted = true;\n"
|
" anyDeleted = true;\n"
|
||||||
" }\n";
|
" } }\n";
|
||||||
}
|
}
|
||||||
wrapperFile.oss <<
|
wrapperFile.oss <<
|
||||||
" if(anyDeleted)\n"
|
" if(anyDeleted)\n"
|
||||||
|
|
Loading…
Reference in New Issue