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

用法

来自本仓库自己的测试项目 —— CI 真的编译并运行过,不是为了网站写的。

#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 · 项目 tests/examples/simdjson-nothreads

构建

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

特性

特性声明了
defaultimplies
threadsdefines

源文件 (1)

  • */singleheader/simdjson.cpp

版本

版本平台 镜像sha256
5.3.0 最新 LinuxWindowsmacOS CN GLOBAL 5e59df8bd3fa…