Added a check for an empty initializor
This commit is contained in:
parent
45f61a0e0b
commit
49434ecc03
1 changed files with 10 additions and 5 deletions
|
|
@ -83,22 +83,27 @@ class eoGpDepthInitializer : public eoInit< eoParseTree<FType, Node> >
|
||||||
eoGpDepthInitializer(
|
eoGpDepthInitializer(
|
||||||
unsigned _max_depth,
|
unsigned _max_depth,
|
||||||
const vector<Node>& _initializor,
|
const vector<Node>& _initializor,
|
||||||
bool _grow = true)
|
bool _grow = true)
|
||||||
:
|
:
|
||||||
eoInit<EoType>(),
|
eoInit<EoType>(),
|
||||||
max_depth(_max_depth),
|
max_depth(_max_depth),
|
||||||
initializor(_initializor),
|
initializor(_initializor),
|
||||||
grow(_grow)
|
grow(_grow)
|
||||||
{}
|
{
|
||||||
|
if(initializor.empty())
|
||||||
|
{
|
||||||
|
throw logic_error("eoGpDepthInitializer: uhm, wouldn't you rather give a non-empty set of Nodes?");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
virtual string className() const { return "eoDepthInitializer"; };
|
virtual string className() const { return "eoDepthInitializer"; };
|
||||||
|
|
||||||
void operator()(EoType& _tree)
|
void operator()(EoType& _tree)
|
||||||
{
|
{
|
||||||
list<Node> sequence;
|
list<Node> sequence;
|
||||||
|
|
||||||
generate(sequence, max_depth);
|
generate(sequence, max_depth);
|
||||||
|
|
||||||
parse_tree<Node> tmp(sequence.begin(), sequence.end());
|
parse_tree<Node> tmp(sequence.begin(), sequence.end());
|
||||||
_tree.swap(tmp);
|
_tree.swap(tmp);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in a new issue