mirror of
https://github.com/ETLCPP/etl.git
synced 2026-10-28 18:07:10 +08:00
make_list was the only make_xxx container factory taking its argument pack by value rather than by forwarding reference, costing an extra move per lvalue argument: each lvalue was copy-constructed into the parameter and then moved into the initializer_list backing array, where the forwarding-reference signature copies it there directly. Rvalue prvalue arguments count the same either way in practice, as copy elision constructs them directly into the by-value parameter. Change the pack to T&&..., matching make_vector, make_forward_list and make_indirect_vector. The deduced reference types decay through common_type, so the element type deduction is unchanged. Adds tests for const/non-const lvalues of the element type (guarding against the forward<T> defect fixed for make_array and make_deque), mixed-type common_type deduction, and an instrumented type counting copy/move constructions, which fails with the by-value signature (one extra move per lvalue argument) and passes with the fix. Also corrects the make_list documentation, which described a make_array-style signature with an explicit element type parameter that never matched the implementation. Verified with clang 22 (C++17): all 93 list tests pass; C++14/20 syntax checks pass. Note: mixed-type lvalue arguments are affected by a separate pre-existing defect in etl::common_type (its two-type specialization recurses with decay<T2> twice instead of decay<T1>, decay<T2>), which already affects the other common_type-based factories and is being fixed separately. Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| binary | ||
| blog | ||
| callbacks | ||
| chrono | ||
| codecs | ||
| containers | ||
| getting-started | ||
| IO | ||
| iterators | ||
| maths | ||
| messaging | ||
| multi-tasking | ||
| patterns | ||
| pseudo-containers | ||
| ranges | ||
| releases | ||
| resourses | ||
| source | ||
| state machines | ||
| strings | ||
| timers | ||
| tutorials | ||
| types | ||
| utilities | ||
| _index.md | ||
| about.md | ||
| Is the ETL free.md | ||