|
|
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
|
|