title: Need a short, complicated C++ code and a longer, understandable version
body: <p>In <a href="https://softwareengineering.stackexchange.com/q/9272/2210">this</a> question, I tried to give an example of two ways of doing the same thing in C++: one short but complicated "fancy" piece of code; and a longer but more readable and understandable way of doing the same thing. The question asks whether it's better to have a well-commented fancy piece of code or a self-commented (i.e. no comments) longer version.</p>
  
  <p>The problem with my example was that the fancy version turned out to be more understandable than the non-fancy version. Since I can't think of any good examples, I figure I'd try asking here. So what I need is two examples of C++ code which produce the exact same result, but in one version the code is short but very complicated and cannot be understood immediately without having to think about it, and a longer but much more readable and understandable version.</p>
  
  <p>I want someone to look at the fancy version and go "Shit, that's complicated. I'm glad it's commented, otherwise I wouldn't have understood what it does" and then look at the longer version and go "Ah, I understand what it does, even without comments". The shorter example should be something like 1-10 lines and the longer maybe 10-30 lines.</p>