mirror of
https://github.com/ETLCPP/etl.git
synced 2026-10-28 18:07:10 +08:00
* Corrected the documented make_xxx factory signatures and examples
The Make template sections across the container documentation had
drifted from the implementations, largely through copy-paste:
- map.md, multimap.md and flat-multimap.md all documented
make_flat_map; multiset.md documented make_set; flat-multiset.md
documented make_flat_set; unordered-multimap.md documented
make_unordered_map. Names and examples now match each container.
- Every signature omitted the C++11-required trailing return type
despite the sections being labelled C++11 and above; several also
used a parameter name (TValues) that did not match any template
parameter, and the unordered map headers were missing a comma.
- forward-list.md documented a make_array-style signature with an
explicit element type; the real function deduces the element type as
the common type of the arguments, as documented for make_list.
- The flat_set/flat_multiset template headers were missing the
variadic parameter pack, and their examples passed a braced list to
a variadic function, which does not compile; set.md used TKeyCompare
where the implementation uses TCompare.
- deque.md and the reference container docs were missing code fences.
- Updated the four reference_flat_* function. However these functions
cannot be instantiated at all (the reference containers have no
initializer_list constructor, since one would dangle by design), so
the documented examples have never compiled.
Every remaining documented example verified to compile with clang 22
(C++17) against the current headers.
* Fixed C++17-only syntax in factory examples and flagged the non-compilable ones
Review feedback on the make_xxx documentation examples:
- All the map-family factory examples are labelled C++11 and above but
constructed their pairs with class template argument deduction
(etl::pair{0, 1}), which requires C++17. The pairs in the make_flat_map,
make_flat_multimap, make_map, make_multimap, make_unordered_map,
make_unordered_multimap, make_reference_flat_map and
make_reference_flat_multimap examples now name their template arguments
explicitly. The template deduction guide examples are unchanged, as
those sections are labelled C++17 and above. Verified with clang 22 in
C++14 mode, which, like C++11, has no deduction guides.
- The four make_reference_flat_* examples are now preceded by a warning
callout stating that they do not currently compile: the functions
cannot be instantiated because the reference containers have no
initializer_list constructor. The examples themselves are retained,
rewritten to pass named lvalues rather than temporaries, since the
reference containers store references to external objects and the
temporaries would dangle even if the functions compiled. The defect
is being reported separately.
---------
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
|
||
|---|---|---|
| .. | ||
| _index.md | ||
| const-map.md | ||
| const-multimap.md | ||
| flat-map.md | ||
| flat-multimap.md | ||
| map.md | ||
| multimap.md | ||
| reference-flat-map.md | ||
| reference-flat-multimap.md | ||
| unordered-map.md | ||
| unordered-multimap.md | ||