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…