return V.first;
}
- static inline bool isEqual(key_type_ref L, key_type_ref R) {
- return ImutContainerInfo<T>::isEqual(L,R);
+ static inline data_type_ref DataOfValue(value_type_ref V) {
+ return V.second;
}
+ static inline bool isEqual(key_type_ref L, key_type_ref R) {
+ return ImutContainerInfo<T>::isEqual(L,R);
+ }
static inline bool isLess(key_type_ref L, key_type_ref R) {
return ImutContainerInfo<T>::isLess(L,R);
}
+ static inline bool isDataEqual(data_type_ref L, data_type_ref R) {
+ return ImutContainerInfo<S>::isEqual(L,R);
+ }
+
static inline void Profile(FoldingSetNodeID& ID, value_type_ref V) {
ImutContainerInfo<T>::Profile(ID, V.first);
ImutContainerInfo<S>::Profile(ID, V.second);
continue;
}
- // FIXME: need to compare data values, not key values, but our
- // traits don't support this yet.
+ // Compare the keys.
if (!ImutInfo::isEqual(ImutInfo::KeyOfValue(LItr->getValue()),
ImutInfo::KeyOfValue(RItr->getValue())))
return false;
+ // Also compare the data values.
+ if (!ImutInfo::isDataEqual(ImutInfo::DataOfValue(LItr->getValue()),
+ ImutInfo::DataOfValue(RItr->getValue())))
+ return false;
+
++LItr;
++RItr;
}
typedef typename ImutProfileInfo<T>::value_type_ref value_type_ref;
typedef value_type key_type;
typedef value_type_ref key_type_ref;
+ typedef bool data_type;
+ typedef bool data_type_ref;
static inline key_type_ref KeyOfValue(value_type_ref D) { return D; }
+ static inline data_type_ref DataOfValue(value_type_ref) { return true; }
static inline bool isEqual(key_type_ref LHS, key_type_ref RHS) {
return std::equal_to<key_type>()(LHS,RHS);
static inline bool isLess(key_type_ref LHS, key_type_ref RHS) {
return std::less<key_type>()(LHS,RHS);
}
+
+ static inline bool isDataEqual(data_type_ref,data_type_ref) { return true; }
};
/// ImutContainerInfo - Specialization for pointer values to treat pointers
typedef typename ImutProfileInfo<T*>::value_type_ref value_type_ref;
typedef value_type key_type;
typedef value_type_ref key_type_ref;
+ typedef bool data_type;
+ typedef bool data_type_ref;
static inline key_type_ref KeyOfValue(value_type_ref D) { return D; }
+ static inline data_type_ref DataOfValue(value_type_ref) { return true; }
static inline bool isEqual(key_type_ref LHS, key_type_ref RHS) {
return LHS == RHS;
static inline bool isLess(key_type_ref LHS, key_type_ref RHS) {
return LHS < RHS;
}
+
+ static inline bool isDataEqual(data_type_ref,data_type_ref) { return true; }
};
//===----------------------------------------------------------------------===//