Boost logo

Boost :

Subject: Re: [boost] [type_traits] MSVC rejects typename -- why?
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2011-03-24 20:23:21


On Thu, Mar 24, 2011 at 3:58 PM, Vicente BOTET <vicente.botet_at_[hidden]> wrote:
>
> Hi,
>
>
> It seems the compiler is not seen it is inside an outer macro.
> In this case it seems that we need another macro e.g.BOOST_NESTED_TYPENAME. You could try to follow the protocol of adding a new macro andpropose apatch to John.
>
> An other alternative: I suspect that the nested structure is code that you generate with your macros in Boost.Local orBoost.Contract. I propose you to define a nested template
>
> template
> void f(T& x) {
> template
> struct s {
> T g() {
> typename boost::remove_reference::type i = 0;
> return i;
> }
> };
> x = s().g();
> }

Yes, for my application I can use class templates instead of function
templates (this is actually not code generated by macros but just a
Boost.Local example for the docs that shows how to use
BOOST_LOCAL_TYPEOF).

I'll leave it up to Boost.Config maintainers to decide if the
introduction of BOOST_NESTED_TYPENAME is needed or not.

Thanks a lot!

-- 
Lorenzo

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