mcpp index

compat.plf-hive

#include

plf::hive — reference implementation of the proposed std::hive (header-only)

#include <plf_hive.h>
mcpp add compat.plf-hive@2026.07.31

用法

來自本倉庫自己的測試專案 —— CI 真的編譯並執行過,不是為了網站寫的。

// compat.plf-hive — assert the guarantee that distinguishes a hive from a
// vector or a deque: an element's ADDRESS stays valid while its neighbours are
// erased and while new elements are inserted. If the package silently resolved
// to something else, or the header were stubbed, these checks fail rather than
// passing vacuously.
#include <plf_hive.h>
import std;

int main() {
    bool ok = true;
    auto check = [&](bool cond, std::string_view what) {
        if (!cond) {
            std::println("FAIL: {}", what);
            ok = false;
        }
    };

    plf::hive<int> h;

    // Fill, and remember where a few elements physically live.
    std::vector<plf::hive<int>::iterator> its;
    for (int i = 0; i < 200; ++i) its.push_back(h.insert(i));
// …

tests/examples/plf-hive/tests/hive.cpp · 專案 tests/examples/plf-hive

建置

targets
plf-hive (lib)
language
c++23
C standard
c11
import std
no
include dirs
*

原始檔 (1)

  • mcpp_generated/plf_hive_anchor.c

產生的檔案

  • mcpp_generated/plf_hive_anchor.c

版本

版本平台 鏡像sha256
2026.07.31 最新 LinuxWindowsmacOS GLOBAL CN 507555191c27…