As far as I understand (as another observer) is that the existing solution with the wrappers was easier to achieve and the full constexpr parameters were considered for a later date (= C++26 or later). What was missing, was some more exploration.

 

https://github.com/cplusplus/papers/issues/1458#issuecomment-2312917449 :

 

"Authors will apply the improvements and publish R5, which will be scheduled for LEWG's review.
NOTE: The option to apply a solution similar to the one proposed in P1045 requires exploration but is still on the table for 26."


 

-----Ursprüngliche Nachricht-----
Von: David Brown <david.brown@hesbynett.no>
Gesendet: Do 26.11.2026 15:55
Betreff: Re: [std-proposals] constexpr specifier for function parameters
An: std-proposals@lists.isocpp.org;
CC: Sebastian Wittmeier <wittmeier@projectalpha.org>; David Brown <david.brown@hesbynett.no>;
I read that issues page (from the link Ivan gave), but access to the
wiki with meeting notes and information requires logging in with
issocpp.org credentials, which I do not have, as I am not involved with
the standardisation process.  (I am basically just an interested
observer here.)

David



On 26/11/2026 14:47, Sebastian Wittmeier via Std-Proposals wrote:
> See here and the Kona meeting
>
> https://github.com/cplusplus/papers/issues/603
>
>     -----Ursprüngliche Nachricht-----
>     *Von:* David Brown via Std-Proposals <std-proposals@lists.isocpp.org>
>     *Gesendet:* Do 26.11.2026 13:14
>     *Betreff:* Re: [std-proposals] constexpr specifier for function
>     parameters
>     *An:* std-proposals@lists.isocpp.org;
>     *CC:* David Brown <david.brown@hesbynett.no>;
>     It looks like P1045 covers pretty much everything I have thought about
>     here, and in much greater detail.  It seems to have achieved initial
>     strong interest, then stalled.  Is that a sign that the idea is
>     dead, or
>     just that the original author was unwilling or unable to take the
>     process further?
>
>     David
>
>
>
>     On 26/11/2026 12:15, Ivan Lazaric via Std-Proposals wrote:
>      > IMO "other than the callsite" is not minor, it trivializes
>     "generic over
>      > is-constant-expression?"
>      > Or, depends how you understand details of what is proposed,
>      > I operate under "constexpr fn parameter can be either constant
>      > expression lifted to template parameter,
>      > or regular old runtime thing", + consteval fn parameters that
>     reject latter.
>      >
>      > ```cpp
>      > void foo(float* ptr, constexpr size_t len) { ... }
>      >
>      > std::array<float, 5> arr = ...;
>      > foo(arr.data(), arr.size()); // foo<5>(float*)
>      > std::vector<float> vec = ...;
>      > foo(vec.data(), vec.size()); // foo(float*, size_t)
>      > ```
>      >
>      > Relevant proposal: P1045 - constexpr Function Parameters
>      > https://web.archive.org/web/20261110020406/https://www.open-std.org/
>      > jtc1/sc22/wg21/docs/papers/2019/p1045r1.html <https://
>     web.archive.org/
>      > web/20261110020406/https://www.open-std.org/jtc1/sc22/wg21/docs/
>      > papers/2019/p1045r1.html>
>      > https://github.com/cplusplus/papers/issues/603 <https://github.com/
>      > cplusplus/papers/issues/603>
>      >
>      > On Thu, Nov 26, 2026 at 11:35 AM Miguel Veganzones via Std-Proposals
>      > <std-proposals@lists.isocpp.org <mailto:std-
>     proposals@lists.isocpp.org>>
>      > wrote:
>      >
>      >     What would be the difference with a normal template parameter
>     other
>      >     than the callsite?
>      >
>      >     I am not too familiar with std::cw, but it seems to solve a
>     common
>      >     issue for me: a function can be implemented with a compile
>     time size
>      >     or a runtime size, but compile time information is preferable if
>      >     available. Such a function could accept 'auto size', check if
>     this
>      >     value is a constant literal, and specialize accordingly. In such
>      >     scenario the caller can provide runtime or compile time
>     information
>      >     to the callee without knowing it itself wether this
>     information is
>      >     usable at compile time.
>      >
>      >     Just my two cents on it.
>      >
>      >     Miguel
>      >
>      >     El jue, 26 nov 2026, 10:58, David Brown via Std-Proposals <std-
>      >     proposals@lists.isocpp.org <mailto:std-
>     proposals@lists.isocpp.org>>
>      >     escribió:
>      >
>      >         In C++26, we now have std::constant_wrapper<> and std::cw<>
>      >         which can
>      >         let you pass constant expressions as normal function
>     parameters,
>      >         and let
>      >         them be used as constant expressions within the function
>      >         definition.
>      >         (We are talking about templated functions here, since each
>      >         std::constant_wrapper<> instance has a unique type for
>     the value
>      >         it wraps.)
>      >
>      >           From cppreference, we have the example :
>      >
>      >                  auto make_filled(auto size, int value)
>      >                  {
>      >                      std::array<int, size> a;
>      >                      a.fill(value);
>      >                      return a;
>      >                  }
>      >
>      >         This can be called from other code as :
>      >
>      >                  auto a = make_filled(std::cw<3>, x);
>      >
>      >         Then "a" is a std::array<3, int> filled with the value of
>     "x".
>      >
>      >         Prior to C++26, you would write this as :
>      >
>      >                  template<size_t size>
>      >                  auto make_filled(int value)
>      >                  {
>      >                      std::array<int, size> a;
>      >                      a.fill(value);
>      >                      return a;
>      >                  }
>      >
>      >                  auto a = make_filled<3>(x);
>      >
>      >
>      >         The use of std::constant_wrapper<> can make the code a little
>      >         neater and
>      >         more consistent - the call site only uses function
>     arguments and
>      >         does
>      >         not also need template arguments, and these can be given
>     in the
>      >         function
>      >         definition in whatever order makes sense.
>      >
>      >         But it means that every call needs to have "std::cw<>"
>     wrappers
>      >         explicitly added - that is more code at each call, more
>     to add,
>      >         more to
>      >         get right, more to understand.
>      >
>      >
>      >         My suggested alternative syntax here would be :
>      >
>      >                  auto make_filled(constexpr size_t size, int value)
>      >                  {
>      >                      std::array<int, size> a;
>      >                      a.fill(value);
>      >                      return a;
>      >                  }
>      >
>      >                  auto a = make_filled(3, x);
>      >
>      >
>      >         Function parameters with the "constexpr" specifier would
>      >         effectively be
>      >         non-type template parameters.  This would be another kind of
>      >         abbreviated
>      >         template, in the same sense as the use of concepts or
>     "auto" in
>      >         place of
>      >         types for function parameters.  A "constepxr" parameter
>     could be of
>      >         fixed type, "auto", a concept, etc., just like any other
>     parameter.
>      >
>      >         The advantage of this would be to give neater and more
>     "universal"
>      >         calling code for template functions with non-type template
>      >         parameters.
>      >         The disadvantage is that it hides the fact that the "size"
>      >         parameter in
>      >         this example must be a constant expression, not a runtime
>     value.
>      >
>      >
>      >         Any thoughts here?  Is it an idea that appeals to people, or
>      >         would it
>      >         feel like it is hiding important information?  Or am I
>     missing
>      >         something
>      >         crucial that would make this impossible or impractical?
>      >
>      >         David
>      >
>      >
>      >
>      >
>      >         --
>      >         Std-Proposals mailing list
>      >         Std-Proposals@lists.isocpp.org <mailto:Std-
>      >         Proposals@lists.isocpp.org>
>      >         https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>      >         <https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals>
>      >
>      >     --
>      >     Std-Proposals mailing list
>      >     Std-Proposals@lists.isocpp.org <mailto:Std-
>     Proposals@lists.isocpp.org>
>      >     https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>      >     <https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals>
>      >
>      >
>
>     --
>     Std-Proposals mailing list
>     Std-Proposals@lists.isocpp.org
>     https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
>