Common: Fix SCOPE_EXIT to actually create unique identifiers.

This commit is contained in:
Yuri Kunde Schlesner 2015-01-11 13:32:31 -02:00
parent afc416c607
commit fc11aff955
2 changed files with 7 additions and 1 deletions

View file

@ -4,6 +4,8 @@
#pragma once
#include "common/common_funcs.h"
namespace detail {
template <typename Func>
struct ScopeExitHelper {
@ -34,4 +36,4 @@ namespace detail {
* }
* \endcode
*/
#define SCOPE_EXIT(body) auto scope_exit_helper_##__LINE__ = detail::ScopeExit([&]() body)
#define SCOPE_EXIT(body) auto CONCAT2(scope_exit_helper_, __LINE__) = detail::ScopeExit([&]() body)