On Thu, Apr 25, 2013 at 4:49 PM, Vincent van Ravesteijn <v...@lyx.org> wrote: > Op 1-4-2013 6:07, Scott Kostyshak schreef: >> I think this is something I need to get used to: I would not have >> thought that this duplication of code (e.g. reparsing the string in >> the same way) was a good solution but I do see this a lot in C++ so >> it's something I need learn. > > > What do you mean ?
Checking whether a debug flag is valid and then setting that debug flag both involve looping through all the debug flags. When initially looking at this, the most natural thing seemed to me that there should be only one loop. But I think this separation of validation and processing is common in C++ and that I should learn to not worry about looping twice instead of once. Especially for such a small vector, this does not have any real performance issue. Besides performance though it still seems to me that the code could be more simple if there were just one loop. Is there a reason why it would be bad in this case to have one loop and throw an exception if a debug flag does not exist? Would it be reasonable to do a try/catch around lyxerr.setLevel(Debug::value(arg)) and obviate the need for Debug::isKnownValue(tmp) ? Scott