Fixed building on MSVC

This commit is contained in:
Bartek Kryza 2023-07-23 18:34:03 +02:00
parent 366bb19912
commit bcd32bfd41

View File

@ -550,18 +550,17 @@ auto Validator<Node>::validate(const Node &doc) const -> std::vector<Error> {
template <typename Node> template <typename Node>
auto Validator<Node>::schema_settings(const Node &schema) -> SchemaSettings { auto Validator<Node>::schema_settings(const Node &schema) -> SchemaSettings {
SchemaSettings settings{ SchemaSettings settings;
.default_required = true, settings.default_required = true;
.optional_tag = "optional", settings.optional_tag = "optional";
.required_tag = "required", settings.required_tag = "required";
.embed_tag = "embed", settings.embed_tag = "embed";
.variant_tag = "variant", settings.variant_tag = "variant";
.key_type_prefix = "$", settings.key_type_prefix = "$";
.generic_brackets = "<>", settings.generic_brackets = "<>";
.generic_separator = ";", settings.generic_separator = ";";
.attribute_separator = ":", settings.attribute_separator = ":";
.ignore_attributes = false, settings.ignore_attributes = false;
};
const Node settings_node = NodeAccessor::at(schema, "settings"); const Node settings_node = NodeAccessor::at(schema, "settings");
@ -623,12 +622,12 @@ auto Validator<Node>::make_error(ErrorType type, const Context &ctx,
const std::vector<std::vector<Error>> &variant_errors) const const std::vector<std::vector<Error>> &variant_errors) const
-> Error { -> Error {
return Error{ Error err;
.type = type, err.type = type;
.path = ctx.path, err.path = ctx.path;
.expected = ctx.expected, err.expected = ctx.expected;
.variant_errors = variant_errors, err.variant_errors = variant_errors;
}; return err;
} }
template <typename Node> template <typename Node>
@ -1022,7 +1021,7 @@ auto Validator<Node>::parse_generic_type(const std::string &type) const -> Gener
generic_type.name += c; generic_type.name += c;
break; break;
case ST_ARGS: case ST_ARGS:
arg = std::string_view{!arg.empty() ? arg.cbegin() : &(*it), arg.size() + 1}; arg = std::string_view{!arg.empty() ? arg.data() : &(*it), arg.size() + 1};
break; break;
case ST_SEP: case ST_SEP:
state = ST_ARGS; state = ST_ARGS;