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…