alias object_t::key_type in basic_json #1442
Labels
state: please discuss
please discuss the issue or vote for your favorite option
state: stale
the issue has not been updated in a while and will be closed automatically soon unless it is updated
I propose simply adding
using key_type = typename object_t::key_type;
tobasic_json<>
Considering
at()
andoperator[]
already make use of it in the public interface, it doesn't seem unreasonable.N.B.
mapped_type
might as well be aliased too for completeness.Caveat: I understand that
find()
does not return an iterator to astd::pair<key_type, mapped_type>
sobasic_json<>
can never be a true map-like as it stands, but unlike thekey_type
issue I illustrate lower down, this is something that can be SFINAE'd around.This would be useful when duck-typing
basic_json<>
as a map-like type. Specifically, the fact thatstd::string_view
is not implicitly convertible tostd::string
is currently making this difficult.Example:
The text was updated successfully, but these errors were encountered: