rleigh-electradx 25e2d6e8a3
Adopt the Library Fundamentals TS make_array design for the sequence factories (#1553)
* Adopt the Library Fundamentals TS make_array design for the sequence factories

make_array, make_deque, make_vector, make_list, make_forward_list and
make_indirect_vector now follow the Library Fundamentals TS
std::experimental::make_array design: a defaulted leading template
parameter selects the element type explicitly, falling back to the
decayed common type of the arguments when it is not supplied. A shared
trait (etl::private_make::element_type) performs the selection lazily,
so common_type is not instantiated when the element type is explicit.

This fixes the explicit-element-type calling style for the four
common-type factories, where make_vector<char>(lvalue) never compiled:
the explicit argument pinned the first pack parameter to char, making
it a char&& that no lvalue can bind to. It also gives make_array and
make_deque the deduced form (e.g. make_array(1, 2L) is array<long, 2>)
for free. All arguments are converted with static_cast, as in the
make_array const-lvalue fix, so const-qualified lvalues and narrowing
initialisers work in both forms.

Intentional behaviour change: an explicit element type now converts
every argument instead of pinning only the first. make_vector<char>(0,
1, ...) previously produced vector<int> - the explicit char affected
only the first argument and the element type was still the common type
- and now produces vector<char>. test_make_vector documented the old
behaviour and has been updated.

The keyed set and map factories are unchanged: their key/mapped types
are separate mandatory template parameters ahead of a fully-deduced
pack, so the explicit-type style already works, and retrofitting
deduction there would interact with the defaulted comparator/hash
parameters.

Adds explicit-element-type tests for the four common-type factories
(const/non-const lvalues plus narrowing initialisers) and
deduced-element-type tests for make_array and make_deque, and updates
the four documented signatures.

* Address review comments on the make_xxx factory design

- Forward same-type arguments in the make_xxx factories instead of
  casting them. static_cast produced a prvalue that, before C++17, had
  to be materialised through the move constructor, rejecting
  copyable-but-non-movable element types. The new
  private_make::convert helper forwards arguments that already have
  the element type and static_casts the rest.
- Drop ETL_NOEXCEPT from make_array: conversions can throw, and the
  other factories do not declare it.
- Remove the redundant etl::decay in element_type<void, ...>;
  etl::common_type already decays its arguments.
- Stop leaking the etl::private_make implementation namespace into the
  documented factory signatures.

* Add a test for make_array with an explicit element type and no arguments

etl::make_array<int>() produces an empty etl::array<int, 0> and now has
a regression test. A call with neither an element type nor arguments
remains ill-formed, matching the Library Fundamentals TS: there is
nothing to deduce the element type from. The array documentation now
states this explicitly.

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
2026-08-24 08:53:25 +01:00
..
binary Issue/add hugo support for documentation (#1449) 2026-06-06 13:12:44 +01:00
blog Various fixes and cleanup (#1507) 2026-07-20 11:19:41 +02:00
callbacks Various fixes and cleanup (#1507) 2026-07-20 11:19:41 +02:00
chrono Various fixes and cleanup (#1507) 2026-07-20 11:19:41 +02:00
codecs Fix code examples in documentation (#1471) 2026-06-23 18:11:17 +01:00
containers Adopt the Library Fundamentals TS make_array design for the sequence factories (#1553) 2026-08-24 08:53:25 +01:00
getting-started Various fixes and cleanup (#1507) 2026-07-20 11:19:41 +02:00
IO Various fixes and cleanup (#1507) 2026-07-20 11:19:41 +02:00
iterators Various fixes and cleanup (#1507) 2026-07-20 11:19:41 +02:00
maths Fix code examples in documentation (#1471) 2026-06-23 18:11:17 +01:00
messaging Various fixes and cleanup (#1507) 2026-07-20 11:19:41 +02:00
multi-tasking Documentation updates (#1469) 2026-06-23 18:12:58 +01:00
patterns Fix code examples in documentation (#1471) 2026-06-23 18:11:17 +01:00
pseudo-containers Issue/add hugo support for documentation (#1449) 2026-06-06 13:12:44 +01:00
ranges Issue/add hugo support for documentation (#1449) 2026-06-06 13:12:44 +01:00
releases Various fixes and cleanup (#1507) 2026-07-20 11:19:41 +02:00
resourses Issue/add hugo support for documentation (#1449) 2026-06-06 13:12:44 +01:00
source Squashed commit of the following: 2026-07-11 13:02:42 +01:00
state machines Hotfix/documentation updates (#1456) 2026-06-08 08:58:47 +01:00
strings Various cleanup (#1562) 2026-08-22 17:47:16 +02:00
timers Various fixes and cleanup (#1507) 2026-07-20 11:19:41 +02:00
tutorials Various fixes and cleanup (#1507) 2026-07-20 11:19:41 +02:00
types Add etl::apply (#1509) 2026-07-16 09:15:24 +01:00
utilities Update etl::expected documentation (#1564) 2026-08-23 23:30:39 +01:00
_index.md Various fixes and cleanup (#1507) 2026-07-20 11:19:41 +02:00
about.md Issue/add hugo support for documentation (#1449) 2026-06-06 13:12:44 +01:00
Is the ETL free.md Issue/add hugo support for documentation (#1449) 2026-06-06 13:12:44 +01:00