Skip to content

What are the exact rules for avoiding OUT_OF_ORDER_ITERATION? #2071

Answered by lemire
intelfx asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks for your interest.

I'd like to understand the exact rules that I have to follow

See point two, from a screenshot of our documentation:

Using the On Demand API, the rule is that you should be in one array or one object at a time, and once you hold an array (for example), then you need to consume it. This may involve storing it in your own data structure.

You cannot collect arrays and then parse these arrays later. You must consume them immediately.

For example:

#include "simdjson.h"
#include <iostream>
#include <string_view>
using namespace std::literals;

using namespace simdjson;

int parse_timestamp(std::string_view v) {
  // could use
  // https://lemire.me/blog/2023/07/01/pa…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@intelfx
Comment options

@lemire
Comment options

Answer selected by intelfx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants