POV-Ray : Newsgroups : povray.off-topic : Adventures with C++ : Re: An actual C++ question Server Time
29 Jul 2024 04:16:31 EDT (-0400)
  Re: An actual C++ question  
From: Kevin Wampler
Date: 23 May 2013 12:29:11
Message: <519e43d7@news.povray.org>
On 5/23/2013 8:58 AM, scott wrote:
>>> boost::shared_ptr<std::vector<Foo>> _foo(new std::vector<Foo>());
>>>
>>> I don't see how the >> is ambiguous at all in this statement. Seems to
>>> me like lazy/bad parser design if this trips it up.
>>
>> It's not quite so cut and dry as you might guess.  For example:
> ...
>>      cout << (boost::shared_ptr<std::vector<Foo>> _foo(NULL)) << endl;
>
> Is that ambiguous?
>


Obviously not since it compiles.  It is, however, ambiguous unless you 
know the types of boost::shared_ptr and std::vector (and you need to 
know them during lexical analysis).  I wasn't saying that it's 
impossible to correctly parse this sort of thing, just that correctly 
parsing it is a more non-trivial task than it might at first appear.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.