path_category

Conversion category for filesystem paths.

Synopsis

Defined in header <boost/json/conversion.hpp>.

struct path_category;

Description

Paths are represented in JSON as strings.

By default a type T is considered a path if given t, a glvalue of type T,

  • given It, the type denoted by decltype(std::begin(t)), std::iterator_traits<It>::iterator_category is well-formed and denotes a type; and

  • std::iterator_traits<It>::value_type is T; and

  • T::value_type is well-formed and denotes a type; and

  • T::string_type is well-formed, denotes a type, and is an alias for std::basic_string< T::value_type >.

Users can specialize conversion_category_for for their own types if they don’t want them to be treated like filesystem paths. For example:

namespace boost {
namespace json {

template <>
struct conversion_category_for<your::path>
{
    using type = path_category;
};

} // namespace boost
} // namespace json

Matching Types

Convenience header <boost/json.hpp>.