Brook Milligan wrote:
Before I write a review, I have a couple of questions that are the outgrowth of having been using mp11 since some time after the first two articles of Peter’s. That should suggest I generally like the library, which I do.
Nevertheless, in my code, I have found need for the following additional metafunctions:
- mp_map_keys: creates a list of keys from a map
With metaprogramming libraries, it's always quite difficult to decide what
to include and what to leave out, as there are so many useful things that
are also one-liners. As everyone has probably surmised by now, I prefer
minimalism, that is, omit by default, only include when a clear need arises.
mp_map_keys, for example, is mp_transform
- mp_is_set: type trait to determine whether a type is a set, i.e., has unique elements
This at the moment is std::is_same, although as I
mentioned, perhaps either mp_is_set or mp_distinct should indeed be
provided.
- mp_is_map: type trait to determine whether a type is a map, i.e., has a unique set of keys
This is mp_is_set
I have also found need for a metafunction that takes a map and a set of keys and returns a map with only elements with the selected keys. This is perhaps more specialized, but I can also see a general use case.
template