I would like to use the class as a key in a dictionary that does not override Equals or GetHashCode. This is a class from an external library that I do not want to modify.
So I'm wondering if I can use custom "GetHashCode" / "Equals" to use for only one dictionary? I was wondering if something like C ++ std :: maps is possible
template < class Key, // map::key_type class T, // map::mapped_type class Compare = less<T>, // map::key_compare class Alloc = allocator<T> > // map::allocator_type > class map;
where Compare can be used to define custom comparisons.
I do not want to deduce from the class, because objects are created externally using an existing class.
I could create a class that contains the source class, but which modifies access to the Dictionary.
Thanks for your ideas!
source share