I need to convert a set of strings similar to /azurite/spot00
to integers in order to use in ML libraries. Hand-rolling an enumerating algorithm (assign i++ to each next label) sounds easy enough. But nowhere nearly as elegant as a bidirectional hash between std::string
and int
(not sure if I need int64
or something else).
std::hash
doesn't seem to state it's reversible. Anything in the standard library?