#ifndef CHOICECONDITION_H_
#define CHOICECONDITION_H_
+#include <msp/core/algorithm.h>
#include "condition.h"
#include "filter.h"
{
if(dynamic_cast<const OrCondition *>(&parent) && !conditions.empty())
{
- ChoiceCondition<T> *result = 0;
+ ChoiceCondition<T> *result = new ChoiceCondition<T>(std::vector<Type>());
for(std::vector<Condition *>::const_iterator i=conditions.begin(); i!=conditions.end(); ++i)
{
const std::vector<Type> &v = static_cast<ChoiceCondition<T> *>(*i)->values;
- if(!result)
- result = new ChoiceCondition<T>(v);
- else
- result->values.insert(result->values.end(), v.begin(), v.end());
+ for(typename std::vector<Type>::const_iterator j=v.begin(); j!=v.end(); ++j)
+ if(Msp::find(result->values, *j)==result->values.end())
+ result->values.push_back(*j);
}
return result;
}