Boost logo

Boost :

Subject: Re: [boost] [scope_exit] Boost.ScopeExit capturing 'this'
From: Peder Holt (peder.holt_at_[hidden])
Date: 2009-03-10 14:13:42


<snip>

> For BOOST_TYPEOF(this) to work on msvc (MS may fix it in vc10) I would
> imagine the msvc BOOST_TYPEOF would need to expand to something like:
>
> enum { boost_typeof_local_typeindex__LINE__ =
> ...expression-that-may-involve-this-to-get-type-index... };
> ...expression-using-type-index-to-get-type...
>
> rather than
>
> ...expression-to-get-type...
>

First of all, sorry for misquoting. The section I intended to quote was:

The common workaround (capturing a compile-time integer with an
enumerator and using the enumerator in the template parameter list)
doesn't work with the vc71-specific implementation of Boost.Typeof
since it is based on typeid() -- this cannot be captured in a
compile-time expression (or I know of no way to that doesn't involve
the expression existing in a template argument list).

Second, thanks for the workaround. I have implemented this for
BOOST_TYPEOF_NESTED_TYPEDEF, so that this can now be used with expressions
containing this for VC compilers.
Usage:
BOOST_TYPEOF_NESTED_TYPEDEF(unique_name,this);
typedef unique_name::type this_type;

Can you use this in stead?

Regards, Peder


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk