[antlr-interest] C++ puzzle

Stuart Dootson stuart.dootson at gmail.com
Wed Jun 29 06:30:38 PDT 2005


On 6/29/05, David Wigg <wiggjd at lsbu.ac.uk> wrote:
> Hi,
> 
> I'm trying to parse the following extract from a C++
> preprocessed file. I wonder if someone could explain what the
> problem statement indicated might mean.
> 

<big snip>

> typedef typename _Alloc::template rebind<_Ty>::other _Alty;    // Problem statement

The 'typename refers to the 'other' identifier. Use of
_Alloc::template rebind implies that _Alloc has a nested class
template called rebind. The whole statement is typedefing _Alty to the
type other, declared in the template instantiation rebind<_Ty>, which
is declared in the template parameter _Alloc. So, _Alloc should look
something like:

struct _Alloc
{
   template <class SomeType>
   struct rebind
   {
      typedef {some-declaration} other;
   };
};

<big snip>

> I wonder if anyone can identify the compiler and version?

Judging by the header file path name, it's VC++ 7.1 (i.e. the one from
Visual Studio .NET 2003).

> 
> Thanks,
> 
> David.
> 

HTH

Stuart Dootson


More information about the antlr-interest mailing list