On Thu, Jun 11, 2015 at 12:30 AM, Keean Schupke <[email protected]> wrote:

> On 10 June 2015 at 17:13, Jonathan S. Shapiro <[email protected]> wrote:
>
>>
>> Umm. Actually, that sounds pretty expensive. The problem isn't popping
>> the vector. The problem is the unnecessary constructions you're going to do
>> every time you *grow* the vector. You want a vector of pointers, not a
>> vector of objects. Though even that's a problem, because the parse stack
>> elements don't have homogeneous type.
>>
>>
>> shap
>>
>
> What unnecessary constructions? It is also polymorphic, a unique pointer
> can point to any subclass just like a plain pointer. Hopefully this will
> make it clearer:
>
> vector<unique_ptr<ast>> region;
>

Right. Once you are using a unique_ptr (or any ptr type), this works fine.
The only real problem with unique_ptr here is that it's sometimes
convenient for AST's to become DAGs in later processing passes.

shap
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to