1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
namespace boost { namespace scope_exit { namespace aux {
template<int> struct declare;
typedef void* declared;
struct undeclared { declared dummy[2]; };
template<>
struct declare<sizeof(undeclared)>
{
template<int>
struct apply
{
declared value;
friend void operator>(bool, const apply&) {}
};
};
template<>
struct declare<sizeof(declared)>
{
static const int apply = 0;
};
} } }
extern boost::scope_exit::aux::undeclared boost_scope_exit_args;
// ...
// bloc d'une méthode/fonction :
{
//....
boost::scope_exit::aux::declare<sizeof(boost_scope_exit_args)> ::apply<0> boost_scope_exit_args;
// ici boost::scope_exit::aux::declare<sizeof(boost_scope_exit_args)> ::apply désigne un type
// celui de declare<sizeof(undeclared)>
//...
boost::scope_exit::aux::declare<sizeof(boost_scope_exit_args)> ::apply<0> boost_scope_exit_args;
// ici boost::scope_exit::aux::declare<sizeof(boost_scope_exit_args)> ::apply désigne un membre
// celle de declare<sizeof(declared)>
} |