return false;
}
+/** \class IsEqual
+ * \ingroup Validators
+ * \brief Auxiliary class used in std::find_if
+ */
class IsEqual {
AttributePtr myAttribute;
public:
+ /// Constructor
IsEqual(const AttributePtr& theAttribute) : myAttribute(theAttribute) {}
+ /// \return true in case if AttributePtr is equal with myAttribute
bool operator()(const AttributePtr& theAttribute) {
return isEqualAttributes(myAttribute, theAttribute);
}
std::list<AttributePtr>::const_iterator aNextIt = anAttributeIt; ++aNextIt;
while (aNextIt != anAttributes.end()) {
// if equal attribute is found then all attributes are not different
- if (std::find_if(aNextIt, anAttributes.end(), IsEqual(*anAttributeIt)) != anAttributes.end())
+ std::list<AttributePtr>::const_iterator aFindIt =
+ std::find_if(aNextIt, anAttributes.end(), IsEqual(*anAttributeIt));
+ if (aFindIt != anAttributes.end()) {
+ theError = "Attributes " + (*anAttributeIt)->id() + " and " + (*aFindIt)->id() + " are equal." ;
return false;
+ }
++anAttributeIt;
++aNextIt;
}