is_map_like
Determine if T
can be treated like a 1-to-1 mapping during conversions.
Synopsis
Defined in header <boost/json/conversion.hpp>.
template<
class T>
struct is_map_like;
Description
Given t
, a glvalue of type T
, if
-
is_sequence_like<T>::value
istrue
; and -
given type
It
denotingdecltype(std::begin(t))
, and typesK
andM
,std::iterator_traits<It>::value_type
denotesstd::pair<K, M>
; and -
std::is_string_like<K>::value
istrue
; and -
given
v
, a glvalue of typeV
, andE
, the type denoted bydecltype(t.emplace(v))
,std::is_tuple_like<E>::value
istrue
;
then the trait provides the member constant value
that is equal to true
. Otherwise, value
is equal to false
.
Users can specialize the trait for their own types if they don’t want them to be treated like mappings. For example:
namespace boost {
namespace json {
template <>
struct is_map_like<your::map> : std::false_type
{ };
} // namespace boost
} // namespace json
The restriction for t.emplace()
return type ensures that the container does not accept duplicate keys.
Types satisfying the trait
See Also
Convenience header <boost/json.hpp>.