Fix windows build

parent 2358baf1
......@@ -367,7 +367,7 @@ template <class F, class... Ts>
struct is_callable_with {
template <class U>
static auto sfinae(U*)
-> decltype((std::declval<U&>()) (std::declval<Ts>()...), std::true_type());
-> decltype((std::declval<U&>())(std::declval<Ts>()...), std::true_type());
template <class U>
static auto sfinae(...) -> std::false_type;
......
......@@ -41,14 +41,15 @@ void encode_impl(std::string_view in, Storage& out) {
for (auto x : buf)
out.push_back(static_cast<value_type>(encoding_tbl[x]));
};
auto end = [](std::string_view str) { return str.data() + str.size(); };
// Iterate the input in chunks of three bytes.
auto i = in.begin();
for (; std::distance(i, in.end()) >= 3; i += 3)
auto i = in.data();
for (; std::distance(i, end(in)) >= 3; i += 3)
consume(i);
// Deal with any leftover: pad the input with zeros and then fixup the output.
if (i != in.end()) {
if (i != end(in)) {
char buf[] = {0, 0, 0};
std::copy(i, in.end(), buf);
std::copy(i, end(in), buf);
consume(buf);
for (auto j = out.end() - (3 - (in.size() % 3)); j != out.end(); ++j)
*j = static_cast<value_type>('=');
......
......@@ -136,7 +136,7 @@ void read_json_null_or_nan(string_parser_state& ps, Consumer consumer) {
template <class Consumer>
void read_json_string(string_parser_state& ps, Consumer consumer) {
auto first = std::string_view::iterator{};
std::string_view::iterator first;
// clang-format off
start();
state(init) {
......@@ -145,7 +145,9 @@ void read_json_string(string_parser_state& ps, Consumer consumer) {
}
state(read_chars) {
transition(escape, '\\')
transition(done, '"', consumer.value(std::string_view{first, static_cast<size_t>(ps.i-first)}))
transition(done, '"',
consumer.value(std::string_view{
std::addressof(*first), static_cast<size_t>(ps.i - first)}))
transition(read_chars, any_char)
}
state(escape) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment