type: Accept any comparator, hash, and allocator in container fields #379

pull ryanofsky wants to merge 1 commits into bitcoin-core:master from ryanofsky:pr/containers changing 7 files +41 −16
  1. ryanofsky commented at 7:34 AM on October 15, 2026: collaborator

    Problem: std::vector, std::set, std::map and std::unordered_set fields and parameters only work when they use the default comparator, hash and allocator types. Anything else, like Bitcoin Core's GCSFilter::ElementSet (std::unordered_set<Element, ByteVectorHash>), fails to compile with "no matching function for call to CustomBuildField". Bitcoin Core currently works around this by copying the std::unordered_set read and build functions into its own code (bitcoin/bitcoin#29409).

    Solution: Make the container overloads in type-vector.h, type-set.h, type-map.h and type-unordered-set.h templates over the containers' comparator, hash and allocator types. Small change to the four headers, plus a FooStruct round-trip test with a descending std::set and std::map, an std::unordered_set with a custom hash, and a std::pmr::vector.

  2. type: Accept any comparator, hash, and allocator in container fields
    Let std::vector, std::set, std::map, and std::unordered_set fields use any
    comparator, hash, or allocator type, instead of only matching containers
    with the default template arguments. Previously, a field like Bitcoin Core's
    GCSFilter::ElementSet (std::unordered_set<Element, ByteVectorHash>) didn't
    match any overload, so Bitcoin Core had to copy the std::unordered_set read
    and build functions to pass it over IPC.
    
    This change was written with Claude Opus 5.5 (1M context).
    9a42d0065d
  3. DrahtBot commented at 7:35 AM on October 15, 2026: none

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    ACK xyzconstant

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  4. xyzconstant commented at 4:29 PM on October 27, 2026: contributor

    ACK 9a42d0065d9a012b6cdaa7780cf2464f473ed2cd

    This allows container fields to use non-default comparator, hash, and allocator types. Needed for bitcoin/bitcoin#29409 where Chain::blockFilterMatchesAny takes a GCSFilter::ElementSet (std::unordered_set<Element, ByteVectorHash>).


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/libmultiprocess. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-10-28 08:30 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me