|
From: Joe Gottman on 19 Jun 2008 07:08 Since by definition integral_constant::value must always be a compile-time constant, it should be constexpr so that the compiler knows this fact. Proposed Resolution: In 20.4.3 replace static const T value = v; with static constexpr T value = v; Joe Gottman -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: Triple-DES on 20 Jun 2008 04:23 On 20 Jun, 00:08, Joe Gottman <jgott...(a)carolina.rr.com> wrote: > Since by definition integral_constant::value must always be a > compile-time constant, it should be constexpr so that the compiler knows > this fact. > > Proposed Resolution: > In 20.4.3 replace > static const T value = v; > with > static constexpr T value = v; > First of all I don't think you can submit a DR to a draft. Second, I don't think your proposed change is correct, since value can appear wherever an integral constant-expression is required. Consider the following examples: // typical integral_constant implementation (value definition snipped) template <class T, T v> struct integral_constant { static const T value = v; typedef T value_type; typedef integral_constant<T,v> type; }; // integral constant required here: char test[integral_constant<int, 42>::value]; // here too: integral_constant<int, integral_constant<int,42>::value> c; DP -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
|
Pages: 1 Prev: regex on istream Next: template specialization for multiple classes |