//--------------------------------------------------------------------------- bool IValue::operator==(const IValue &a_Val) const { char_type type1 = GetType(), type2 = a_Val.GetType(); if (type1 == type2 || (IsScalar() && a_Val.IsScalar())) { switch (GetType()) { case 'i': case 'f': return GetFloat() == a_Val.GetFloat(); case 'c': return GetComplex() == a_Val.GetComplex(); case 's': return GetString() == a_Val.GetString(); case 'b': return GetBool() == a_Val.GetBool(); case 'v': return false; case 'm': if (GetRows() != a_Val.GetRows() || GetCols() != a_Val.GetCols()) { return false; } else { for (int i = 0; i < GetRows(); ++i) { if (const_cast<IValue*>(this)->At(i) != const_cast<IValue&>(a_Val).At(i)) return false; } return true; } default: ErrorContext err; err.Errc = ecINTERNAL_ERROR; err.Pos = -1; err.Type1 = GetType(); err.Type2 = a_Val.GetType(); throw ParserError(err); } // switch this type } else { return false; } }