id
stringlengths
16
145
text
stringlengths
1
179k
title
stringclasses
1 value
cpp_utility/76362_72_0.txt
jfyi ` constexpr int Array[] = {1, 2}; ` produces compillation error ` error: array index 3 is past the end of the array (that has type 'const int[2]') [-Werror,-Warray-bounds] ` as expected.
cpp_utility/constexprarraysize_88_0.txt
void push_back(std::span<int, 5> const&);
cpp_utility/76362_107_0.txt
---
cpp_utility/0eQsx6ip1DwJpli1_225_0.txt
> \-- > > \--- > You received this message because you are subscribed to the Google Groups > "ISO C++ Standard - Discussion" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [ std-discussio...@isocpp.org ]() . > To post to this group, send email to [ std-dis...@isocpp.or...
cpp_utility/0eQsx6ip1DwJpli1_206_0.txt
Forward
cpp_utility/76362_123_0.txt
## Footer
cpp_utility/76362_106_0.txt
According to compiler explorer msvc just gives up on constant expression and moves everything into runtime with a warning. Which is not great but still better than clang and gcc which just generate nothing.
cpp_utility/constexprarraysize_81_0.txt
Even if we say that we can propagate references to our heart’s delight during constant evaluation, as long as we don’t read them, that wouldn’t help us here. ` dynamic_span ` is a dynamic ` span ` , its ` size() ` member function is non-static, so we very much do need to read through the reference.
cpp_utility/constexprarraysize_74_0.txt
template <typename T, size_t Extent> struct span { template <range R> span(R&& r) requires (std::size(r) == Extent); };
cpp_utility/76362_116_0.txt
None yet
cpp_utility/0eQsx6ip1DwJpli1_169_0.txt
Report message
cpp_utility/0eQsx6ip1DwJpli1_237_0.txt
Report message
cpp_utility/0eQsx6ip1DwJpli1_190_0.txt
You do not have permission to delete messages in this group
cpp_utility/0eQsx6ip1DwJpli1_165_0.txt
Sign in to forward
cpp_utility/0eQsx6ip1DwJpli1_62_0.txt
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
cpp_utility/76362_99_0.txt
Sorry, something went wrong.
cpp_utility/76362_127_0.txt
You can’t perform that action at this time.
cpp_utility/0eQsx6ip1DwJpli1_249_0.txt
![thomas....@gmail.com's profile photo](//lh3.googleusercontent.com/a-/ALV- UjVq8xDenE_ld09oVulVi_L6DDR0P6HNO238KE-HE-hEJwaYWd5iOQ=s40-c)
cpp_utility/76362_75_0.txt
All reactions
cpp_utility/0eQsx6ip1DwJpli1_203_0.txt
Oct 14, 2013, 3:18:18 PM 10/14/13
cpp_utility/CanIconstexpranstdar_40_0.txt
const int pid = getpid(); // ok; `pid` cannot be changed you can’t call getpid when initializing a constexpr variable, since it doesn’t yield a compile-time constant.
cpp_utility/constexprarraysize_100_0.txt
And none of the hypothetical language changes I’ve described in this post are exactly trivial either, so I expect we’ll have to live this problem for a while…
cpp_utility/0eQsx6ip1DwJpli1_122_0.txt
Forward
cpp_utility/0eQsx6ip1DwJpli1_294_0.txt
0 new messages
cpp_utility/76362_125_0.txt
### Footer navigation
cpp_utility/0eQsx6ip1DwJpli1_3_0.txt
Send feedback to Google
cpp_utility/cpp_tag_0_4.txt
http://es.cppreference.com/w/cpp/utility/piecewise_construct "cpp/utility/piecewise construct") * [ Français ](http://fr.cppreference.com/w/cpp/utility/piecewise_construct "cpp/utility/piecewise construct") * [ Italiano ](http://it.cppreference.com/w/cpp/utility/piecewise_construct "cpp/utility/piecewise construct"...
cpp_utility/0eQsx6ip1DwJpli1_228_0.txt
unread,
cpp_utility/76362_43_0.txt
* [ Code ](/llvm/llvm-project) * [ Issues 5k+ ](/llvm/llvm-project/issues) * [ Pull requests 2.3k ](/llvm/llvm-project/pulls) * [ Actions ](/llvm/llvm-project/actions) * [ Security ](/llvm/llvm-project/security) * [ Insights ](/llvm/llvm-project/pulse)
cpp_utility/0eQsx6ip1DwJpli1_73_0.txt
unread,
cpp_utility/76362_101_0.txt
[ ![@dyumin](https://avatars.githubusercontent.com/u/7953339?s=80&u=0377142aa5372554770ee1881c7b9d199c450429&v=4) ](/dyumin)
cpp_utility/constexprarraysize_75_0.txt
void f(span<int, 5>);
cpp_utility/76362_59_0.txt
[ clang:diagnostics ](/llvm/llvm-project/labels/clang%3Adiagnostics) New/improved warning or error message in Clang, but not in clang-tidy or static analyzer [ false-negative ](/llvm/llvm-project/labels/false-negative) [ undefined behaviour ](/llvm/llvm-project/labels/undefined%20behaviour)
cpp_utility/0eQsx6ip1DwJpli1_288_0.txt
> Hello, > I'm playing around with the relaxed constraints on constexpr functions with > clang + libc++ trunk and noticed something strange with std::array : Because > std::array lacks a constexpr "reference operator[]" (23.3.2.1.3), it is > impossible to instantiate an std::array in a constepxr function and write in ...
cpp_utility/76362_16_0.txt
* Open Source
cpp_utility/0eQsx6ip1DwJpli1_258_0.txt
You do not have permission to delete messages in this group
cpp_utility/0eQsx6ip1DwJpli1_60_0.txt
Sign in to report message
cpp_utility/76362_44_0.txt
Additional navigation options
cpp_utility/76362_25_0.txt
Clear
cpp_utility/0eQsx6ip1DwJpli1_234_0.txt
Delete
cpp_utility/0eQsx6ip1DwJpli1_32_0.txt
to std-dis...@isocpp.org
cpp_utility/constexprarraysize_24_0.txt
This would be more obvious if our situation used pointers instead of references:
cpp_utility/0eQsx6ip1DwJpli1_119_0.txt
Oct 13, 2013, 5:18:00 PM 10/13/13
cpp_utility/76362_49_0.txt
By clicking “Sign up for GitHub”, you agree to our [ terms of service ](https://docs.github.com/terms) and [ privacy statement ](https://docs.github.com/privacy) . We’ll occasionally send you account related emails.
cpp_utility/0eQsx6ip1DwJpli1_110_0.txt
[...]
cpp_utility/76362_70_0.txt
successfully compiles with ` --std=c++20 -O3 -Wall -Werror -Wpedantic -Winvalid-constexpr ` on clang 17.0.1.
cpp_utility/0eQsx6ip1DwJpli1_224_0.txt
> > >
cpp_utility/constexprarraysize_46_0.txt
But even with fixed-extent, there are some conversions that would be perfectly safe to be implicit: arrays! Arrays have the size encoded in the type, we surely know at compile time if an array has 5 elements or not, so this _could_ be perfectly fine:
cpp_utility/0eQsx6ip1DwJpli1_291_0.txt
 Reply all
cpp_utility/0eQsx6ip1DwJpli1_252_0.txt
Oct 14, 2013, 5:46:37 PM 10/14/13
cpp_utility/0eQsx6ip1DwJpli1_149_0.txt
Report message
cpp_utility/76362_124_0.txt
[ ](https://github.com "GitHub") © 2024 GitHub, Inc.
cpp_utility/cpp_classes_3_4.txt
c_tuple_size&action=edit) [ std::tuple_element <std::pair> ](/w/cpp/utility/pair/tuple_element "cpp/utility/pair/tuple element") (C++11) | obtains the type of the elements of ` pair ` (class template specialization) [ [edit] ](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/utility/pair/dsc_tupl...
cpp_utility/76362_52_0.txt
# constexpr std::array out-of-bounds array index access compiles without warnings or errors #76362
cpp_utility/CanIconstexpranstdar_4_0.txt
Which is exactly what happened when Queen Elizabeth passed away in 2022. So overall, Willian inherited quite a bit more than Harry.
cpp_utility/76362_24_0.txt
Search
cpp_utility/0eQsx6ip1DwJpli1_21_0.txt
Reply to author
cpp_utility/76362_47_0.txt
**Have a question about this project?** Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
cpp_utility/0eQsx6ip1DwJpli1_142_0.txt
Reply to author
cpp_utility/cpp_tag_0_2.txt
ity/as_const "cpp/utility/as const") (C++17) Common vocabulary types | [ pair ](/w/cpp/utility/pair "cpp/utility/pair") --- [ tuple ](/w/cpp/utility/tuple "cpp/utility/tuple") (C++11) [ optional ](/w/cpp/utility/optional "cpp/utility/optional") (C++17) [ any ](/w/cpp/utility/any "cpp/utility/any") (...
cpp_utility/cpp_classes_3_3.txt
Member types * 1.4 Example * 1.5 Defect reports * 1.6 See also --- ## Inherited from [ std:: integral_constant ](/w/cpp/types/integral_constant "cpp/types/integral constant") ### Member constants value [static] | the constant value 2 (public static member constant) ---|--- ...
cpp_utility/0eQsx6ip1DwJpli1_140_0.txt
unread,
cpp_utility/0eQsx6ip1DwJpli1_39_0.txt
By the way my original attempt was to try to write a constexpr function that would sort a list of integers at compile time without any template metaprogramming, just classic imperative style. The plan was to take advantage of the fact that std::array<T, N> is a literal type when T is a literal type (3.9.10) so it shoul...
cpp_utility/0eQsx6ip1DwJpli1_152_0.txt
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
cpp_utility/0eQsx6ip1DwJpli1_64_0.txt
2013/10/12 < [ thomas....@gmail.com ]() >:
cpp_utility/0eQsx6ip1DwJpli1_282_0.txt
Report message
cpp_utility/0eQsx6ip1DwJpli1_208_0.txt
Delete
cpp_utility/76362_10_0.txt
For
cpp_utility/CanIconstexpranstdar_29_0.txt
Short version: constexpr tells the compiler that the item it qualifies should be evaluated at compile time and the result treated as a compile-time constant.
cpp_utility/0eQsx6ip1DwJpli1_101_0.txt
Delete
cpp_utility/0eQsx6ip1DwJpli1_55_0.txt
Sign in to forward
cpp_utility/0eQsx6ip1DwJpli1_16_0.txt
Skip to first unread message
cpp_utility/0eQsx6ip1DwJpli1_44_0.txt
} return std::array<int, N>{a[idx]...}; // and copy the result in a std::array }
cpp_utility/constexprarraysize_22_0.txt
### Wait, why? __
cpp_utility/0eQsx6ip1DwJpli1_264_0.txt
to std-dis...@isocpp.org
cpp_utility/constexprarraysize_10_0.txt
By _[ Barry Revzin ](https://twitter.com/BarryRevzin) _
cpp_utility/0eQsx6ip1DwJpli1_167_0.txt
You do not have permission to delete messages in this group
cpp_utility/CanIconstexpranstdar_41_0.txt
constexpr int pid = getpid(); // error In turn, the compiler will allow you to use that variable in contexts where a compile-time constant is required, such as a template argument.
cpp_utility/76362_39_0.txt
You signed in with another tab or window. [ Reload ]() to refresh your session. You signed out in another tab or window. [ Reload ]() to refresh your session. You switched accounts on another tab or window. [ Reload ]() to refresh your session. Dismiss alert
cpp_utility/cpp_tag_2_5.txt
t ` can be used in the constructor's parameter list to match the intended tag. 2) The corresponding ` std::nontype ` instance of (1) is a disambiguation argument tag that can be passed to the constructors of std::function_ref to indicate that the contained object should be constructed with the value of the non-ty...
cpp_utility/0eQsx6ip1DwJpli1_251_0.txt
unread,
cpp_utility/0eQsx6ip1DwJpli1_38_0.txt
I don't understand why reference std::array::operator[] is not constepxr. At first I thought it was to avoid some unsafe usage or constness issue but I can't think of any. In fact now that we have.relaxed constexpr and that constepxr member function are no longer implicitly const it looks to me that the keyword "const...
cpp_utility/0eQsx6ip1DwJpli1_279_0.txt
Delete
cpp_utility/0eQsx6ip1DwJpli1_166_0.txt
Delete
cpp_utility/0eQsx6ip1DwJpli1_276_0.txt
Sign in to reply to author
cpp_utility/cpp_classes_0_5.txt
中文 ](http://zh.cppreference.com/w/cpp/utility/pair "cpp/utility/pair") * This page was last modified on 27 March 2024, at 19:48. * This page has been accessed 2,260,398 times. * [ Privacy policy ](/w/Cppreference:Privacy_policy "Cppreference:Privacy policy") * [ About cppreference.com ](/w/Cppreference:Abou...
cpp_utility/0eQsx6ip1DwJpli1_58_0.txt
Copy link
cpp_utility/0eQsx6ip1DwJpli1_102_0.txt
You do not have permission to delete messages in this group
cpp_utility/constexprarraysize_13_0.txt
This issue was first pointed out to me by Michael Park, and mostly explained to me by T.C.
cpp_utility/76362_86_0.txt
---
cpp_utility/0eQsx6ip1DwJpli1_177_0.txt
The constexpr keyword does have utility.
cpp_utility/76362_90_0.txt
[ ![@shafik](https://avatars.githubusercontent.com/u/6431709?s=80&v=4) ](/shafik)
cpp_utility/0eQsx6ip1DwJpli1_24_0.txt
Sign in to forward
cpp_utility/0eQsx6ip1DwJpli1_20_0.txt
Oct 12, 2013, 10:43:09 PM 10/12/13
cpp_utility/cpp_classes_4_0.txt
##### [ cppreference.com ](/) [ Log in ](/mwiki/index.php?title=Special:UserLogin&returnto=cpp%2Futility%2Fpair%2Ftuple+element "You are encouraged to log in; however, it is not mandatory \[o\]") ##### Namespaces * [ Page ](/w/cpp/utility/pair/tuple_element "View the content page \[c\]") * [ Discussion ](/mwik...
cpp_utility/0eQsx6ip1DwJpli1_161_0.txt
Oct 14, 2013, 3:31:14 AM 10/14/13
cpp_utility/76362_46_0.txt
New issue
cpp_utility/0eQsx6ip1DwJpli1_128_0.txt
Sign in to report message
cpp_utility/76362_78_0.txt
[ ![@dyumin](https://avatars.githubusercontent.com/u/7953339?s=80&u=0377142aa5372554770ee1881c7b9d199c450429&v=4) ](/dyumin)
cpp_utility/0eQsx6ip1DwJpli1_94_0.txt
### Gabriel Dos Reis