P3971R0 — std::rebind - Generalized Type Rebinding for Containers and Uniform-Element Types
(11 items)
LEWG
This paper proposes std::rebind, a facility for uniformly converting containers and other types with uniform element types to use a different element type while preserving structure. It introduces two complementary components: a type trait rebind_t for compile-time type computation and a customisation point object std::rebind(obj) for performing the actual conversion, with standard library support for sequence containers and std::complex, and extensibility via ADL for user-defined types. The motivation is to fill the gap left by the lack of a generalized rebinding mechanism, generalizing the pattern already established by allocator rebinding and std::simd's rebind_t.
-
§3.2, §5.5, §6.1.2 — rebind_alloc_t is presented as an existing standard library facility, but no such standalone alias template exists in the C++ standard; only std::allocator_traits
::rebind_alloc exists. Either propose rebind_alloc_t as a new addition in §6 or use the qualified form throughout. [3] [1] - §6.1 section heading / Table of Contents — Stable name rendered as "[utility. rebind]" with a spurious space; should be "[utility.rebind]". [2] [2]
- References / Informative References — P1928R15 and P3445R0 are cited in the body but have no corresponding bibliography entries. [3]
- Title / §1 Revision History — Paper number in the title says R1 but the revision history contains only an R0 entry with no R1 changelog. [4]
- Title — Paper number and title are concatenated with no separator: "P3971R1std::rebind". [1] [5]
- §2.2 Proposed Solution (code sample) — Spurious space in "Container:: value_type"; should be "Container::value_type". [6] [6]
- §5.5 Naming Alternatives — Spurious space in "std::allocator_traits:: rebind_alloc"; should be "std::allocator_traits::rebind_alloc". [5] [7]
- §5.2 Tuple and Pair (code sample) — Spurious space in "p. second"; should be "p.second". [4] [8]
References — Anthropic Citations API
[1]
"# P3971R1std::rebind" (title) and "R0 Initial revision" (§1, full revision history)"
"# P3971R1std::rebind" (title) and "R0 Initial revision" (§1, full revision history)"
[2]
chars 0–456
"# P3971R1std::rebind - Generalized Type Rebinding for Containers and Uniform-Element Types ## Published Proposal, 2026-02-20 This version: http://wg21.link/P3971 Author: Daniel Towner..."
"# P3971R1std::rebind - Generalized Type Rebinding for Containers and Uniform-Element Types ## Published Proposal, 2026-02-20 This version: http://wg21.link/P3971 Author: Daniel Towner..."
[3]
chars 18771–18839
"[utility. rebind] Generalised element-type conversion #### 6.1.1. "
"[utility. rebind] Generalised element-type conversion #### 6.1.1. "
[4]
"The references section contains only "[P3045R1]" (spans 1-112 through 1-115), but the paper cites "[P1928R15]" (e.g., "The std::simd proposal [P1928R15]") and "[P3445R0]" (e.g., "Recent discussion..."
"The references section contains only "[P3045R1]" (spans 1-112 through 1-115), but the paper cites "[P1928R15]" (e.g., "The std::simd proposal [P1928R15]") and "[P3445R0]" (e.g., "Recent discussion..."
[5]
chars 14059–14363
"The term "rebind" is already well-established for analogous type transformations: Allocator rebinding (std::allocator_traits:: rebind_alloc, rebind_alloc_t): Converting an allocator from one..."
"The term "rebind" is already well-established for analogous type transformations: Allocator rebinding (std::allocator_traits:: rebind_alloc, rebind_alloc_t): Converting an allocator from one..."
[5]
chars 14059–14363
"The term "rebind" is already well-established for analogous type transformations: Allocator rebinding (std::allocator_traits:: rebind_alloc, rebind_alloc_t): Converting an allocator from one..."
"The term "rebind" is already well-established for analogous type transformations: Allocator rebinding (std::allocator_traits:: rebind_alloc, rebind_alloc_t): Converting an allocator from one..."
[6]
chars 11508–11743
"Users who need to convert tuple or pair elements can explicitly construct the target type: ``` std::pair p = {1, 2};
std::pair..."
"Users who need to convert tuple or pair elements can explicitly construct the target type: ``` std::pair
[7]
chars 14059–14363
"The term "rebind" is already well-established for analogous type transformations: Allocator rebinding (std::allocator_traits:: rebind_alloc, rebind_alloc_t): Converting an allocator from one..."
"The term "rebind" is already well-established for analogous type transformations: Allocator rebinding (std::allocator_traits:: rebind_alloc, rebind_alloc_t): Converting an allocator from one..."
[7]
chars 14059–14363
"The term "rebind" is already well-established for analogous type transformations: Allocator rebinding (std::allocator_traits:: rebind_alloc, rebind_alloc_t): Converting an allocator from one..."
"The term "rebind" is already well-established for analogous type transformations: Allocator rebinding (std::allocator_traits:: rebind_alloc, rebind_alloc_t): Converting an allocator from one..."
[8]
chars 3701–4574
"Proposed Solution We propose two complementary facilities: rebind_t - A type trait that computes the result type of rebinding the structure from elements of type T to use elements of..."
"Proposed Solution We propose two complementary facilities: rebind_t - A type trait that computes the result type of rebinding the structure from elements of type T to use elements of..."
Summary: Proposes std::rebind_t and std::rebind as generic type traits that replace the element type of containers, tuples, pairs, and other uniform-element types, unifying a pattern currently handled ad hoc by each template's own rebind mechanism.
Pipeline: Discovery (Anthropic Opus + Citations API) → Verification Gate (OpenRouter Opus) → Report Writer (OpenRouter Opus)
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.