namespace hp
{
+ /**
+ * Exception thrown when comparing hp::Collection iterators into different
+ * objects.
+ *
+ * @ingroup Exceptions
+ */
+ DeclExceptionMsg(ExcDifferentCollection,
+ "You are trying to compare iterators into different "
+ "hp::Collection objects.");
+
/**
* An iterator for hp::Collection.
*/
bool
operator==(const CollectionIterator<T> &other) const
{
- Assert(
- this->data == other.data,
- ExcMessage(
- "You are trying to compare iterators into different hp::Collection objects."));
+ Assert(this->data == other.data, ExcDifferentCollection());
return this->index == other.index;
}
bool
operator!=(const CollectionIterator<T> &other) const
{
- Assert(
- this->data == other.data,
- ExcMessage(
- "You are trying to compare iterators into different hp::Collection objects."));
+ Assert(this->data == other.data, ExcDifferentCollection());
return this->index != other.index;
}