|
|
Slime wrote:
>> const Tree& build_tree(std::vector<SymbolInfo> info)
>> {
>> std::vector<Tree> trees;
>>
> ...
>> return trees[0];
>> }
>
> You are returning a reference to a local variable.
DOH!! >_<
Yeah, that can't be good...
> You might also want to assert( trees.size() > 0 ) to make sure the function
> worked properly and there's something there to return.
The loop right above that is while(trees.size() > 1). Each pass of the
loop removes two trees and inserts one tree.
> That's the only actual problem I see. Otherwise I'm a little worried,
> efficiency-wise, about how many vectors you're copying around, but that may
> not be worth worrying about at this stage.
Yeah, that too...
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
|