Yep, the non pointer version is an issue, didn't look at it as it didn't have compile errors Smiley

Performance wise I'd say that the bool variant is the fastest. std::function is cleaner but it has larger time & space overhead. But you know what they say, premature optimization is the root of all evil. Things like CreateFile or LoadLibrary will take far more time to complete than the few instructions that are need by make_scope/scoped.

If you really want it to be fast then the first thing you'll want to do is to get rid of make_scoped, it's not "free".