mcpp index

compat.simdjson

#include

Parsing gigabytes of JSON per second — SIMD-accelerated C++ JSON parser

#include <simdjson.h>
mcpp add compat.simdjson@5.3.0

Usage

From this repository's own test project — built and run by CI, not written for the website.

#include <cstdio>
#include <string_view>

#include <simdjson.h>

// Note: on Windows MSVC/clang-cl `/MD` defines `_MT`, which simdjson.h maps
// to SIMDJSON_THREADS_ENABLED internally. On POSIX targets without `-pthread`,
// `default-features = false` must leave SIMDJSON_THREADS_ENABLED undefined.
#if !defined(_WIN32) && defined(SIMDJSON_THREADS_ENABLED)
#error "expected default-features = false to omit SIMDJSON_THREADS_ENABLED on non-Windows targets"
#endif

int main() {
    const simdjson::padded_string json = R"({"ok":true,"count":3})"_padded;
    simdjson::ondemand::parser parser;
    simdjson::ondemand::document doc;
    if (parser.iterate(json).get(doc) != simdjson::SUCCESS) {
        return 1;
    }
    bool flag = false;
    int64_t count = 0;
    bool ok = doc["ok"].get_bool().get(flag) == simdjson::SUCCESS && flag;
// …

tests/examples/simdjson-nothreads/tests/test_simdjson_nothreads.cpp · project tests/examples/simdjson-nothreads

Build

targets
simdjson (lib)
language
c++23
import std
no
include dirs
*/singleheader

Features

featuredeclares
defaultimplies
threadsdefines

Sources (1)

  • */singleheader/simdjson.cpp

Versions

VersionPlatforms Mirrorssha256
5.3.0 latest LinuxWindowsmacOS CN GLOBAL 5e59df8bd3fa…