Hi,
During the implementation of my static_map, I recently encountered a
problem: how to deal with string types?
For example:
constexpr auto cmap_str = make_static_map({
{"abc", 1},
{"bcd", 2}
});
static_assert(cmap_str["abc"] == 1, "test");
In my implementation, KeyType requires
1. constexpr operator==, which is not provided by const char *
2. constexpr hash(const KeyType&). Since there is no such thing in
standard library, I have to implement some in this project.
Currently I would like to use string_view, since it looks like a general
solution for compile-time string with lots of constexpr functions, but I
don't know which of the following designs looks better:
Design A:
template