Closed MacroUniverse closed 2 years ago
I could fairly easily overload operator << so that cout would work. In the meantime, just cast the SafeInt back to its type, and then cout will work.
Implementing the hashing function is pretty easy, you can just do this, since there's specializations already for all the types that SafeInt can wrap:
template
Note - I didn't go and make sure this would work, but this appears to be the approach used when using an unordered_map with something other than the basic types.
BTW, the rich text parser ate some of the code - the template can't be fully specified, as SafeInt itself is a template, so:
template < typename T >
Then you just end up returning std::hash for type T, since there's a built in specialization for all the integer types.
This is now documented in helpfile.md
When using std::unordered_map<> with SafeInt, there's an error saying std::hash is undefined. Could you add a hash function to the namespace std ? Also,
cout <<
doesn't seem to work ether.