问题
I currently try to format C++/CLI code using clang-format (version 9.0.0). I cannot figure how to handle for each
statements.
Before:
for each (auto i in I)
{
}
After (say, CTRL-K/CTRL-D in Visual Studio):
for
each (auto i in I)
{
}
I read here this:
...you might want to change ForEachMacros to add "for each"
I tried this:
ForEachMacros:
- for each
- foreach
- Q_FOREACH
- BOOST_FOREACH
then this:
ForEachMacros:
- 'for each'
and this:
- "for each"
and even this:
- "for\s+each"
Nothing works. Is there a way to make it works? In the doc, it is written that it (ForEachMacros
) is a vector of macros... so I don't see how a can create a macro with a space character inside!
Can someone help me with this problem?
Thanks!
来源:https://stackoverflow.com/questions/58995706/using-clang-format-with-c-cli-for-each