If I want to generate a hash for a given object in Java, the easiest way I know is to use Apache Commons HashCodeBuilder
public class Person {
String name;
int age;
boolean smoker;
...
public int hashCode() {
return new HashCodeBuilder(17, 37).
append(name).
append(age).
append(smoker).
toHashCode();
}
}
Is there something similar in C ++?
source
share