How to RAIIfy this common pattern?

Pages: 12
I played with my post above a bit more and was able to write a C++14 version, but my MSVC still complains about "auto" appearing in a template parameter. Still, neither GCC nor Clang have any issue. I'll admit that I didn't really understand why MSVC is complaining, but perhaps someone could make headway with the version here, which is maybe closer to working: http://rextester.com/FTWIG95683 .

Last edited on
helios,
When you don't understand something, you can ask.

As for me, I never told I didn't understand the idea nor your question. I just say that maybe you have requirement or limitations you don't tell us about.

Keep cool man. If you don't need help, just don't ask.
You clearly didn't understand the question though, since your proposed solution is entirely inappropriate to the problem.
@helios, you're not wrong, but the way you replied on page 1 could be interpreted as being deliberately harsh. I understand if you don't have patience for people that try a solution without understanding the problem--I'm not here to judge that--but expect to get more "comeback" justification responses like punksheep's or tpb's the next time.
Topic archived. No new replies allowed.
Pages: 12