Closed daniel-j-h closed 8 years ago
This works however, it will not work with situations where we are using a recursive wrapper such as:
struct value;
using value_base = mapbox::util::variant<int, double, mapbox::util::recursive_wrapper<std::vector<value>>>;
struct value : value_base {
using value_base::value_base;
};
std::unordered_set<value> vs;
vs.insert(1);
vs.insert(2.1);
vs.insert({2, 3.2});
Forget my comments -- I was mistaken in thinking that there was a std::hash<std::vector<T>>
by default in the STL.
@daniel-j-h - looks good but I think we can do even better by using type_index
? This way we don't need a requirement for underlying types to be hashable and it'll be cheaper also. Tell me I'm missing something :) What do you think?
cc @artemp @flippmoke
125