id
stringlengths
16
145
text
stringlengths
1
179k
title
stringclasses
1 value
cpp_utility/cpp_tag_1_2.txt
e if noexcept") (C++11) [ as_const ](/w/cpp/utility/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)...
cpp_utility/76362_96_0.txt
constexpr auto x = Array[3];
cpp_utility/0eQsx6ip1DwJpli1_212_0.txt
Sign in to report message
cpp_utility/0eQsx6ip1DwJpli1_57_0.txt
You do not have permission to delete messages in this group
cpp_utility/CanIconstexpranstdar_37_0.txt
Promoted by Roundhouse Provisions Profile photo for Matt Jennings Matt Jennings Dramatization only - Roundhouse Provisions · Updated 1y What is the best way to keep energy levels high throughout the day? Just look at the legendary Chuck Norris’s advice since he is now a whopping 81 years old and yet has MORE energy tha...
cpp_utility/0eQsx6ip1DwJpli1_275_0.txt
Reply to author
cpp_utility/CanIconstexpranstdar_47_0.txt
Promoted by Webflow Profile photo for Metis Chan Metis Chan Works at Webflow · Tue What is the best way to build your own website? With today’s modern day tools there can be an overwhelming amount of tools to choose from to build your own website. It’s important to keep in mind these considerations when deciding on whi...
cpp_utility/0eQsx6ip1DwJpli1_211_0.txt
Report message
cpp_utility/76362_126_0.txt
* [ Terms ](https://docs.github.com/site-policy/github-terms/github-terms-of-service) * [ Privacy ](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement) * [ Security ](https://github.com/security) * [ Status ](https://www.githubstatus.com/) * [ Docs ](https://docs.github.com/) * [ Contact ](ht...
cpp_utility/0eQsx6ip1DwJpli1_281_0.txt
Copy link
cpp_utility/constexprarraysize_17_0.txt
We have ` constexpr ` , so let’s use it:
cpp_utility/constexprarraysize_31_0.txt
If ` param ` were a reference, the initialization of ` s4 ` would be ill- formed (for the same reason as previously), but because it’s a value, this is totally fine.
cpp_utility/constexprarraysize_52_0.txt
As already pointed out, since ` r ` is a reference, ` std::size(r) ` cannot be a constant expression, so this constraint cannot be made to work. This would work fine if ` r ` was not a reference (but then we’d be constructing a ` span ` to refer to a range that is about to get destroyed, so this is a particularly tort...
cpp_utility/76362_74_0.txt
The text was updated successfully, but these errors were encountered:
cpp_utility/CanIconstexpranstdar_35_0.txt
In the same way C++20 brought constexpr evaluation for std::string and std::vector, we could have had constexpr std::map.
cpp_utility/0eQsx6ip1DwJpli1_61_0.txt
Show original message
cpp_utility/0eQsx6ip1DwJpli1_79_0.txt
Delete
cpp_utility/cpp_classes_5_4.txt
--|--- [ ` __cpp_lib_integer_sequence ` ](/w/cpp/feature_test#cpp_lib_integer_sequence "cpp/feature test") | 201304L | (C++14) | Compile-time integer sequences ### [ [ edit ](/mwiki/index.php?title=cpp/utility/integer_sequence&action=edit&section=8 "Edit section: Example") ] Example Note: see _Possible ...
cpp_utility/0eQsx6ip1DwJpli1_168_0.txt
Copy link
cpp_utility/0eQsx6ip1DwJpli1_23_0.txt
Forward
cpp_utility/76362_62_0.txt
Copy link
cpp_utility/constexprarraysize_5_0.txt
[ Home ](/) The constexpr array size problem __
cpp_utility/0eQsx6ip1DwJpli1_185_0.txt
Reply to author
cpp_utility/0eQsx6ip1DwJpli1_219_0.txt
> > I could re-add "constexpr" to various array methods during a revision. But > you have to show that said decorator is the best choice. Using the > "constexpr" decorator forces all implementors to use it for a given method > from that point on. So you have to show that a given method can be > implemented as constexp...
cpp_utility/0eQsx6ip1DwJpli1_65_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_45_0.txt
* [ Code ](/llvm/llvm-project) * [ Issues ](/llvm/llvm-project/issues) * [ Pull requests ](/llvm/llvm-project/pulls) * [ Actions ](/llvm/llvm-project/actions) * [ Security ](/llvm/llvm-project/security) * [ Insights ](/llvm/llvm-project/pulse)
cpp_utility/0eQsx6ip1DwJpli1_148_0.txt
Copy link
cpp_utility/0eQsx6ip1DwJpli1_227_0.txt
### Daryle Walker
cpp_utility/0eQsx6ip1DwJpli1_239_0.txt
Show original message
cpp_utility/0eQsx6ip1DwJpli1_216_0.txt
On Mon, Oct 14, 2013 at 12:06 AM, Daryle Walker < [ dar...@gmail.com ]() > wrote:
cpp_utility/0eQsx6ip1DwJpli1_51_0.txt
Oct 12, 2013, 11:05:21 PM 10/12/13
cpp_utility/76362_109_0.txt
Sorry, something went wrong.
cpp_utility/constexprarraysize_26_0.txt
void check(int const (*param)[3]) { constexpr auto s2 = array_size(param); // error }
cpp_utility/76362_53_0.txt
Open
cpp_utility/76362_98_0.txt
All reactions
cpp_utility/0eQsx6ip1DwJpli1_115_0.txt
\-- Gaby
cpp_utility/0eQsx6ip1DwJpli1_18_0.txt
### thomas....@gmail.com
cpp_utility/0eQsx6ip1DwJpli1_240_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/CanIconstexpranstdar_42_0.txt
constexpr int N = 42; std::array<int Profile photo for Matthew L Reigada Matthew L Reigada Software Engineer (2014–present)Author has 3.3K answers and 8.7M answer views · 4y Related In C++, should I use a smart pointer to point to an element in an array owned by a std::unique_pointer? Which one? In C++, should I use a ...
cpp_utility/0eQsx6ip1DwJpli1_99_0.txt
Forward
cpp_utility/0eQsx6ip1DwJpli1_50_0.txt
unread,
cpp_utility/0eQsx6ip1DwJpli1_98_0.txt
Sign in to reply to author
cpp_utility/0eQsx6ip1DwJpli1_173_0.txt
to std-dis...@isocpp.org
cpp_utility/0eQsx6ip1DwJpli1_30_0.txt
Show original message
cpp_utility/0eQsx6ip1DwJpli1_214_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_38_0.txt
[ Sign up ](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser- name%3E%2F%3Crepo- name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header- repo&source_repo=llvm%2Fllvm-project)
cpp_utility/constexprarraysize_65_0.txt
So it’s, at best, a partial and unsatisfying solution. But at least it does offer a way to reliably get the size of an array as a constant expression - it’s just that we have to go back to using a macro:
cpp_utility/0eQsx6ip1DwJpli1_229_0.txt
Oct 14, 2013, 4:36:19 PM 10/14/13
cpp_utility/cpp_tag_0_1.txt
[ Three-way comparison ](/w/cpp/utility#Three-way_comparison "cpp/utility") [ three_way_comparable three_way_comparable_with ](/w/cpp/utility/compare/three_way_comparable "cpp/utility/compare/three way comparable") (C++20) (C++20) [ strong_ordering ](/w/cpp/utility/compare/strong_ordering "cpp/utility/compare/s...
cpp_utility/76362_112_0.txt
No one assigned
cpp_utility/0eQsx6ip1DwJpli1_274_0.txt
Aug 10, 2014, 10:30:25 PM 8/10/14
cpp_utility/0eQsx6ip1DwJpli1_107_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_47_0.txt
` constepxr std :: array < int , 4> sorted_indices = compile_time_sort < 4 , 6 , 1 , 9 >(); // OK ! `
cpp_utility/76362_115_0.txt
Projects
cpp_utility/constexprarraysize_41_0.txt
One of the big features of ` span<T> ` is that all contiguous ranges over ` T ` are convertible to it. This conversion is safe, cheap, and desirable.
cpp_utility/76362_119_0.txt
Development
cpp_utility/0eQsx6ip1DwJpli1_27_0.txt
Copy link
cpp_utility/0eQsx6ip1DwJpli1_241_0.txt
to std-dis...@isocpp.org, thomas....@gmail.com
cpp_utility/0eQsx6ip1DwJpli1_151_0.txt
Show original message
cpp_utility/0eQsx6ip1DwJpli1_48_0.txt
![Daniel Krügler's profile photo](//lh3.googleusercontent.com/a-/ALV- UjU6w5Pn4vKpuWI3PdgssB0yM7vs5YmkHSVB4Z-wFc-TsrKQhQ=s40-c)
cpp_utility/constexprarraysize_82_0.txt
In order to make this example work, we’d need to not only have a reference propagation rule (to make the ` c_array ` and ` cpp_array ` cases work), but we’d also need to adopt something like function parameter constraints (see [ P1733 ](https://wg21.link/p1733) and [ P2049 ](https://wg21.link/p2049) , and my response [...
cpp_utility/76362_35_0.txt
To see all available qualifiers, see our [ documentation ](https://docs.github.com/search-github/github-code-search/understanding- github-code-search-syntax) .
cpp_utility/cpp_tag_0_0.txt
##### [ cppreference.com ](/) [ Log in ](/mwiki/index.php?title=Special:UserLogin&returnto=cpp%2Futility%2Fpiecewise+construct "You are encouraged to log in; however, it is not mandatory \[o\]") ##### Namespaces * [ Page ](/w/cpp/utility/piecewise_construct "View the content page \[c\]") * [ Discussion ](/w/Ta...
cpp_utility/76362_41_0.txt
[ llvm ](/llvm) / **[ llvm-project ](/llvm/llvm-project) ** Public
cpp_utility/0eQsx6ip1DwJpli1_105_0.txt
Sign in to report message
cpp_utility/cpp_classes_4_2.txt
"cpp/utility/move if noexcept") (C++11) [ as_const ](/w/cpp/utility/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/op...
cpp_utility/constexprarraysize_1_0.txt
[ Barry's C++ Blog ](/)
cpp_utility/constexprarraysize_33_0.txt
### Why might we care? __
cpp_utility/0eQsx6ip1DwJpli1_106_0.txt
Show original message
cpp_utility/76362_73_0.txt
---
cpp_utility/CanIconstexpranstdar_45_0.txt
The purpose of smart pointers is to embed the concept of ownership into semantics, in order to prevent memory leaks. The only smart pointer type which does not retain ownership of the data it points to is std::weak_ptr, which is specifically for providing weak access to objects owned by an std::shared_ptr.
cpp_utility/76362_22_0.txt
Search or jump to...
cpp_utility/0eQsx6ip1DwJpli1_70_0.txt
\- Daniel
cpp_utility/0eQsx6ip1DwJpli1_138_0.txt
![Gabriel Dos Reis's profile photo](//lh3.googleusercontent.com/a-/ALV- UjVW4OFlDr9Bw4WDM3C-Z_4g3zS3ML4n5VZ6mKjI7NqkVJBMUg=s40-c)
cpp_utility/cpp_classes_0_4.txt
termines the common type of two ` pair ` s (class template specialization) [ [edit] ](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/utility/pair/dsc_common_type&action=edit) [ std::formatter <std::pair> ](/w/cpp/utility/format/tuple_formatter "cpp/utility/format/tuple formatter") (C++23) | for...
cpp_utility/cpp_classes_3_2.txt
noexcept") (C++11) [ as_const ](/w/cpp/utility/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) [ ...
cpp_utility/0eQsx6ip1DwJpli1_135_0.txt
Constexpr sort-of documents that a function is supposed to work a certain way, and in doing so may enable the user to forget the more precise documentation and manual diagnostic work that he still must do. See the StackOverflow post. The confusion, and code modifications required for adoption, run deep enough that a lo...
cpp_utility/0eQsx6ip1DwJpli1_54_0.txt
Forward
cpp_utility/76362_114_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/constexprarraysize_112_0.txt
Using the [ Jekyll ](https://jekyllrb.com) theme [ Chirpy ](https://github.com/cotes2020/jekyll-theme-chirpy) .
cpp_utility/0eQsx6ip1DwJpli1_174_0.txt
On Sun, Oct 13, 2013 at 2:18 AM, David Krauss < [ pot...@gmail.com ]() > wrote:
cpp_utility/0eQsx6ip1DwJpli1_34_0.txt
constexpr int foo () { int i [] = { 1 , 2 , 3 , 4 }; i [ 0 ]= i [ 1 ]; // OK return i [ 0 ]; }
cpp_utility/0eQsx6ip1DwJpli1_246_0.txt
[Just checked that the const -mode access methods are marked constexpr in N3691.]
cpp_utility/constexprarraysize_87_0.txt
The three calls to ` push_back ` all invoke a function whose signature would be:
cpp_utility/cpp_classes_3_0.txt
##### [ cppreference.com ](/) [ Log in ](/mwiki/index.php?title=Special:UserLogin&returnto=cpp%2Futility%2Fpair%2Ftuple+size "You are encouraged to log in; however, it is not mandatory \[o\]") ##### Namespaces * [ Page ](/w/cpp/utility/pair/tuple_size "View the content page \[c\]") * [ Discussion ](/mwiki/inde...
cpp_utility/0eQsx6ip1DwJpli1_183_0.txt
unread,
cpp_utility/0eQsx6ip1DwJpli1_84_0.txt
Show original message
cpp_utility/0eQsx6ip1DwJpli1_269_0.txt
By doing a quick scan of the standard I would say that there is at least two components where marking all member function constexpr should be fairly non- controversial :std::array and std::complex
cpp_utility/76362_51_0.txt
Jump to bottom
cpp_utility/constexprarraysize_69_0.txt
There is no library solution for this, maybe there’s a language one? The obvious language rule would be to say something like: simply passing around a reference from one function to another is fine - it’s not until you actually _need_ the reference for something that we start requiring it to be a valid constant express...
cpp_utility/0eQsx6ip1DwJpli1_231_0.txt
Sign in to reply to author
cpp_utility/cpp_tag_0_3.txt
_t ` assume that each tuple argument becomes the element of a pair. The overloads that use ` std::piecewise_construct_t ` assume that each tuple argument is used to construct, piecewise, a new object of specified type, which will become the element of the pair. ### [ [ edit ](/mwiki/index.php?title=cpp/utility/piecew...
cpp_utility/0eQsx6ip1DwJpli1_117_0.txt
### David Krauss
cpp_utility/76362_77_0.txt
[ ![@dyumin](https://avatars.githubusercontent.com/u/7953339?s=40&u=0377142aa5372554770ee1881c7b9d199c450429&v=4) ](/dyumin) [ dyumin ](/dyumin) changed the title ~~constexpr std::array out- of-bounds array index in a constant expression compiles without warnings or errors~~ constexpr std::array out-of-bounds array ind...
cpp_utility/CanIconstexpranstdar_2_0.txt
I have built std::array values at compile time via tail-recu
cpp_utility/0eQsx6ip1DwJpli1_40_0.txt
// don't compile template < int ... i > std :: array < int , sizeof ...( i )> compile_time_sort () { constepxr int N = sizeof ...( i ); std :: array < int , N > a = { i ...}; for ( int i = 0 ; i < N ; i ++){ // plan was to sort the array here, with classic imperative style // bu...
cpp_utility/constexprarraysize_80_0.txt
f(dynamic_span); // still error!
cpp_utility/cpp_classes_1_4.txt
#include <array> #include <cstddef> #include <ranges> #include <tuple> #include <utility>   template<class T, [std::size_t](http://en.cppreference.com/w/cpp/types/size_t) Size> struct Arr { T data[Size]; }; // a program-defined specialization of std::tuple_size: template<class...
cpp_utility/76362_100_0.txt
[ ![@shafik](https://avatars.githubusercontent.com/u/6431709?s=40&v=4) ](/shafik) [ shafik ](/shafik) added the [ undefined behaviour ](/llvm/llvm- project/labels/undefined%20behaviour) label Dec 27, 2023
cpp_utility/0eQsx6ip1DwJpli1_35_0.txt
constexpr int bar () { auto tup = std :: make_tuple ( 1 , 2 , 3 , 4 ); std :: get < 0 >( tup ) = std :: get < 1 >( tup ); // OK because T& std::get<I>(tuple) is constexpr ! return std :: get < 0 >( tup ); }