Talk:Main Page/suggestions/archive 1

tuple_element for span
On page tuple_element for span shouldn't the constraint read "The program is ill-formed if I >= N or if N == std::dynamic_extent." instead of I > N?

Xaos (talk) 00:57, 15 May 2019 (PDT)
 * Yes, fixed, thanks! T. Canens (talk) 05:39, 15 May 2019 (PDT)

Move the c++ 11 move block to not include the "and"
For the 76.104.203.143 11:44, 14 June 2019 (PDT)
 * If you are referring to "Omits copy constructors"? That's how it works to enable switching between the C++98/03 and the C++11 views. --Cubbi (talk) 13:45, 14 June 2019 (PDT)

inconsistent capitalization
In https://en.cppreference.com/w/cpp/atomic/memory_order "thread 1" is capitalized inconsistently in the text description of the relaxed ordering - sometimes it's "thread 1", sometimes "Thread 1". Same for "thread 2".

Thanks, Dan 109.66.82.93 10:20, 31 March 2019 (PDT)
 * ✅ Use lowercase consistently. Fruderica (talk) 18:23, 21 April 2019 (PDT)

precision and width of ios_base
The descriptions of the second overloads do not mention returning the previous value as is done for instance with fill of basic_ios. — Preceding unsigned comment added by 2a00:23c6:8b1b:d800:59f4:fa4:b8bb:5760 (talk • contribs) 01:20, 2 May 2019


 * ✅ The descriptions of return value are for both overloads. I think there is nothing missing. --Fruderica (talk) 08:04, 2 May 2019 (PDT)

The given example in "C++ new expression" can't be compiled.
In this page, ,

The initializer is not optional if

- a placeholder (auto or decltype(auto) (since C++14)) is used in type - type is an array of unknown bound

auto p = new auto('c');         // creates a single object of type char. p is a char* double* p = new double[]{1,2,3}; // creates an array of type double[3]

The last line of code couldn't be compiled with GCC8.1 c++2a, Clang5.0 C++17, which is wired. I searched the net and find nothing related about it.So please confirm if it is a mistake. Thank you.
 * Array size deduction in new-expressions is a newly adopted (2019-03) defect report. Currently we don't treat it as a C++20 feature. --Fruderica (talk) 21:37, 6 May 2019 (PDT)
 * Added to table. T. Canens (talk) 20:56, 12 May 2019 (PDT)

std::raw_storage_iterator example code does not consider std::get_temporary_buffer quirks
I know this is all stuff that is being removed in C++20, but: in the example in std it calls std and goes straight on the returned pointer.

However, is a non-binding request that may return less memory than requested, so, before actually using the provided pointer to store the elements, it should check if it actually got enough memory for them.

Cvtsi2sd (talk) 01:47, 17 May 2019 (PDT)
 * Fixed, thanks! T. Canens (talk) 06:10, 17 May 2019 (PDT)

Example code on cpp/chrono
The example code on cpp/chrono contains this line:

"std::chrono::duration elapsed_seconds = end-start;"

And later:

"std::cout << 'elapsed time: ' << elapsed_seconds.count << 's\n';"

Where is it guaranteed that this overload of std::chrono::duration produces a duration whose resolution will be one tick per second? I can't see such a guarantee here: cpp/chrono/duration/duration.

Therefore I suggest either adding a note to cpp/chrono/duration/duration that the third overload always produces a duration whose resolution is one tick per second or, if there is no such guarantee, editing the example on cpp/chrono to explicitly multiply count with period. — Preceding unsigned comment added by 2a02:a317:2241:7a00:d8b0:a5f3:732e:361f (talk • contribs)
 * The default template argument for the second template parameter of is, so  is , which is one tick per second. T. Canens (talk) 13:57, 18 May 2019 (PDT)

itoa missing
The C function itoa isn't in the search result, I think it's a missing link or something.
 * is not a standard C function. See also this. --Fruderica (talk) 06:39, 19 May 2019 (PDT)

Remove the second "the"
In the Exceptions section of https://en.cppreference.com/w/cpp/string/basic_string/to_wstring we have this sentence where "the" is repeated:

"May throw std::bad_alloc from the the std::wstring constructor."

Alexis wilke (talk) 16:14, 20 May 2019 (PDT)
 * Fixed. T. Canens (talk) 07:05, 23 May 2019 (PDT)

Typo in Array page
Tiny typo in second paragraph (after first code snippet) in https://en.cppreference.com/w/cpp/language/array#Arrays_of_unknown_bound:

"Because array element cannot have incomplete type [...]" should be
 * "Because an array element cannot [...]" or
 * "Because array elements cannot [...]"

BR

217.10.52.10 01:05, 21 May 2019 (PDT) André
 * Fixed. T. Canens (talk) 07:04, 23 May 2019 (PDT)

noexcept specifier
Page "noexcept specifier" states "Unlike pre-C++17 throw, noexcept will not call std::unexpected". I doubt it is true and std::unexpected not called on exception in noexcept function. 2A00:65E0:6:1007:655D:E6AA:6E31:1F4 01:31, 21 May 2019 (PDT)
 * It calls std instead. T. Canens (talk) 06:21, 23 May 2019 (PDT)

Add bandit testing framework as a testing library
Bandit could be added to the Testing section of cpp/links/libs --188.108.241.90 07:03, 21 May 2019 (PDT)
 * ✅ --Fruderica (talk) 06:59, 23 May 2019 (PDT)

C++ assert and __func__
The C++ documentation of the assert macro () says the output in case of failure must include the value of __func__; this is only true starting with C++11. Please, add a "since C++11" tag. 2001:B01:2404:4:0:0:0:56 04:55, 23 May 2019 (PDT)
 * ✅ --Fruderica (talk) 06:54, 23 May 2019 (PDT)


 * Thanks! 2001:B01:2404:4:0:0:0:56 04:57, 24 May 2019 (PDT)

Lacking info
https://en.cppreference.com/w/cpp/thread/promise/set_value

This page is missing a lot of info.

In particular: - What is 'R' (since it is not defined as a template). - The prototype #4 has no details on what it does


 * edited #4's description, although the existing example already showed how it's used. --Cubbi (talk) 12:01, 23 May 2019 (PDT)


 * Regarding template parameters, I also think it is generally inconvenient that the pages on members of class templates sometimes refer to template parameters, but require a click to the parent page to see them. Perhaps we could edit those headers so that cpp/thread/promise/set_value opens with, and cpp/memory/shared_ptr/shared_ptr opens with etc. That would be quite a bit of work, though.. --Cubbi (talk) 12:01, 23 May 2019 (PDT)


 * I've put the needed changes at playground. Someone needs to double check and then apply these changes. --D41D8CD98F (talk) 03:50, 31 May 2019 (PDT)
 * If you can format it as something suitable as input to pagefromfile.py, I can probably run it this weekend. T. Canens (talk) 08:42, 31 May 2019 (PDT)
 * done --D41D8CD98F (talk) 17:30, 31 May 2019 (PDT)

Why the type of span .size is index_type not size_type like other containers?
Cqwrteur (talk) 17:52, 24 May 2019 (PDT)
 * As far as cppreference concerned: because that's what the working draft says. Also, span is not a container. T. Canens (talk) 01:20, 26 May 2019 (PDT)

regex/basic_regex has broken examples
Most specifically, the full name for icase is std::regex_constants::icase not std::regex::icase

and likewise for ECMAscript

Espie (talk) 04:27, 25 May 2019 (PDT)
 * std republishes the constants as class members. T. Canens (talk) 01:20, 26 May 2019 (PDT)

std::ref and std::crew page is misleading regarding their availability since C++11
The page: https://en.cppreference.com/w/cpp/utility/functional/ref

states that ref and cref are "since C++11", but this is partially incorrect. While the function templates have been available since C++03 from TR1, what is new with the functions (sans the versions that take a T&&, items (3) and (6)) is the noexcept, but otherwise, the functions can be used in C++03 (and typically under namespace std::tr1

Jestrada (talk) 09:41, 27 May 2019 (PDT) Javier


 * TR1 is not C++03. If someone finds it worthwhile to write up this part of history, it would be a new set of pages under cpp/experimental --Cubbi (talk) 06:44, 28 May 2019 (PDT)

Editing permissions please
This account is over a year old - not very active but legit none the less. Forgotten what I wanted to do now, please make it so I can in future (I know mediawiki and how to behave, here for talk pages rather than the slightest risk damaging such a useful resource with any kind of imperfections!) Alec (talk) 05:21, 30 May 2019 (PDT)
 * Addendum:  I do know Mediawiki really well (and, unfortunately, PHP) - including plugins and internals (eg parser - yes really, if you know Mediawiki with HTML tags, tags, templates, markup, tables, parser functions, magic words, ect all done in a weird order you can appreciate that I went so deep down this rabbit hole I met a guy called Morpheus who offered me a pill which'd let me wake up without remembering anything from that night), managing permissions, managing the database ect ect. Least I can (offer) to do Alec (talk) 05:25, 30 May 2019 (PDT)
 * The restriction is based on autoconfirmed, and I suspect you've crossed that threshold now. T. Canens (talk) 18:07, 2 June 2019 (PDT)

typo at std::map::insert
// here --> c++17


 * is correct: see n3337's [map.overview] --Cubbi (talk) 08:20, 11 June 2019 (PDT)

Validating my account in order to edit the compiler support (compliance) page
Hi. A couple of months ago I requested updating the Embarcadero C++Builder compliance entries in the cpp/compiler_support page, using [] as a reference.

I'm a "new user" and new users are barred from editing that page. In fact, I created my account several months ago for the purpose of editing that page!

An ex-colleague of mine with an older account was very nice and has since assisted with editing the tables today. You'll see they're now up to date.

Is it possible to get my account validated as a genuine, non-vandalising user, please? I'm the product manager for C++Builder, and I can accurately edit its entries ;)

You can contact me to verify this is indeed my account at david dot millington @embarcadero.com.

Vintagedave (talk) 12:19, 17 June 2019 (PDT) Vintagedave
 * You should be able to edit now. Let me know if it doesn't work. T. Canens (talk) 19:26, 17 June 2019 (PDT)
 * I can (haven't committed a change, but I saw I no longer get the 'new user' warning message when trying to edit.) Thankyou! Much appreciated.
 * Vintagedave (talk) 05:02, 18 June 2019 (PDT)Vintagedave

including cstddef in the std::size_t snippet
Why does the std::size_t code snippet contain ? If it’s not needed, can we remove it? Thanks. — LLarson   (said &amp; done) 09:01, 13 May 2019 (PDT)
 * that's one of the six headers where std::size_t is guaranteed to be defined, as noted on that same page. Removing it makes a non-portable program. --Cubbi (talk) 09:18, 13 May 2019 (PDT)
 * However, also appears in synopsis of many other headers in the standard, such as . Is it permitted by the standard that including  does not make  available? --Fruderica (talk) 00:06, 14 May 2019 (PDT)
 * You may have a point.. but it's probably still better to include what you use explicitly: SF.10 --Cubbi (talk) 06:01, 14 May 2019 (PDT)
 * Yes. It can spell it, for instance. The only thing you are guaranteed to get from including a header is the things actually declared in the synopsis. T. Canens (talk) 06:03, 14 May 2019 (PDT)

Code doesn't build
In https://en.cppreference.com/w/cpp/container/map/find the

LightKey lk = { 2 }; auto search2 = example2.find(lk);

doesn't build, because example2 is FatKey not LightKey.


 * The code demonstrates a C++14 feature. It certainly builds with modern toolchains. --Cubbi (talk) 06:01, 14 May 2019 (PDT)

Match parameter order on std::basic_string::copy
The signature for std::basic_string::copy (https://en.cppreference.com/w/cpp/string/basic_string/copy) is as follows:

size_type copy( CharT* dest,               size_type count,                size_type pos = 0) const;

But on the parameters section the order is as follows:

dest, pos, count

This might induce people in error. They should be changed match the signature:

dest, count, pos

144.64.39.198 16:13, 11 June 2019 (PDT) Saco

This site is starting to be riddled with errors!
This site used to be the final source of info for C++. But it seems since they locked it down, errors just linger and even proliferate. Maybe it stopped large scale "vandalism", but it has made the site less trustworthy, and therefore less useful.

I just felt like venting because I used to fix small typos and mistakes, now I can't even do that, an they linger, even when I report them.

std::get(std::variant), section "Parameters": Shouldn't this be "T" instead of "Type"?
Referring to https://en.cppreference.com/w/cpp/utility/variant/get, section "Parameters", it is currently "Type - unique type to look up". Shouldn't it be "T - unique type to look up"? 213.61.229.130 00:30, 21 June 2019 (PDT)
 * Fixed. --Fruderica (talk) 04:29, 21 June 2019 (PDT)

Note on set::iterator and set::const_iterator
The wiki template Template:cpp/container/assoc_note currently says:

The member types and  may be aliases to the same type. Since is convertible to,  should be used in function parameter lists to avoid violations of the One Definition Rule.

This is a bit unclear, leading to Stack Overflow question https://stackoverflow.com/questions/56701128

Suggested new wording:

The member types and  may be aliases to the same type. This means defining a pair of function overloads using the two types as parameter types may violate the One Definition Rule. Since is convertible to, a single function with a  as parameter type will work instead.

Aschepler (talk) 14:09, 21 June 2019 (PDT)
 * agreed and applied --Cubbi (talk) 14:23, 21 June 2019 (PDT)

ftell returns -1 on error, not EOF
The page describing the C function ftell states that eof is returned if the function fails. However, the example on the page, the corresponding C++ page, and the C11 draft I can find (N1570) all state that it returns in such a situation. Could this be fixed, please? 72.51.112.25 09:12, 3 July 2019 (PDT)


 * Fixed. --Fruderica (talk) 04:46, 4 July 2019 (PDT)

Min and Max pages should have See Also Clamp
In the "See also" section of the pages for min and max there should be a link to the clamp page. https://en.cppreference.com/w/cpp/algorithm/min https://en.cppreference.com/w/cpp/algorithm/max https://en.cppreference.com/w/cpp/algorithm/clamp

Added. --Fruderica (talk) 04:45, 4 July 2019 (PDT)

bug on https://en.cppreference.com/w/cpp/filesystem/file_size
it said there:

"std::uintmax_t file_size( const std::filesystem::path& p );" "The non-throwing overload returns -1 on errors."

and in the end

File size = 1 filesystem error: cannot get file size: Is a directory [/dev]

This does not match. uint is never -1
 * Fixed. --Fruderica (talk) 04:44, 4 July 2019 (PDT)

Using function-like macros to expand __FILE__ and __LINE__
The documentation for source_location, at

,

states that, if not using source_location, the user has to resort to a function-like macro. Why would not an object-like macro be OK? 37.182.205.198 04:58, 17 June 2019 (PDT)
 * Edited. I think object-like macros are also OK. --Fruderica (talk) 06:32, 21 June 2019 (PDT)

MSVC support for P1164
Fruderica, thank you so much for updating the feature table, including the detailed charconv tooltip!

"But this page says that P1164 has been implemented in VS 2019 16.0. Is it implemented or not?"

That's an excellent catch. That page is correct - P1164 is indeed implemented in VS 2019 16.0, toolset 19.20. You've found a mistake in my internal spreadsheet, and in our STL header comments. I'll go fix both (it's a long story, involving us implementing this feature when it was still in draft form, and multiple oversights on my part regarding my spreadsheet).

STL MSFT (talk) 12:39, 10 May 2019 (PDT)


 * Thanks for replying. I've added P1161R1 to the table. And I think might be considered as partially supported in VS 2017 15.6 (or 15.7?). I've found that all required functions are marked with  except for . --Fruderica (talk) 03:50, 11 May 2019 (PDT)

std::filesystem::canonical example is slightly incorrect
https://en.cppreference.com/mwiki/index.php?title=cpp/filesystem/canonical

The current example shows as:

but the relative path stops short one directory level for what the example shows.

It should be


 * Fixed. T. Canens (talk) 19:48, 15 July 2019 (PDT)

The page https://en.cppreference.com/w/cpp/regex is not correct
\S+ should be \w+

\S == non-whitespace

2620:18C:0:0:0:0:0:208 10:00, 22 June 2019 (PDT)
 * We want to count as one word, not two. T. Canens (talk) 19:51, 15 July 2019 (PDT)

Suggestion to fix menu
I think in the navigation menu (Template:cpp/language/declarations/navbar_content), "asm-definition" should be replaced by "asm-declaration". --62.46.159.123 00:59, 13 April 2019 (PDT)
 * The item asm-definition is used by the standard, so it's not necessary to change. --Fruderica (talk) 07:21, 21 April 2019 (PDT)
 * This is now asm-declaration, to match the latest WP. T. Canens (talk) 19:52, 15 July 2019 (PDT)

Prefer using to typedef in std::ratio_add example
In page I would prefer to see:

using sum = std::ratio_add;

instead of

typedef std::ratio_add sum; 79.146.131.211 02:36, 25 July 2019 (PDT)
 * Modified examples in std, std, std, and std. --Fruderica (talk) 20:12, 26 July 2019 (PDT)

Update for cpp/compiler support
Consistency improvements for comparisons P1120r) has been implemented for EDG in release 5.1.
 * Updated. --Fruderica (talk) 19:58, 26 July 2019 (PDT)

Can't add an example as a new user
I want to add a universal example of how to use.

However, I can't do it as a newly registered user because of antivandalism policy. Can my account be unblocked? What time should I wait till the moment I can edit pages?

EVG Vir (talk) 07:32, 23 July 2019 (PDT)
 * try now --Cubbi (talk) 07:53, 23 July 2019 (PDT)
 * Thank you, it's working now. EVG Vir (talk) 00:01, 24 July 2019 (PDT)

Update for cpp/compiler support
Since the cpp/compiler support pages editing is temporarily disabled, I am asking if someone with permission can make the following addition:

Simplifying implicit lambda capture is in the EDG eccp 5.1 release. ADL and function templates that are not visible is in the EDG eecp 5.1 release.

Thank you. 24.246.167.173 12:57, 17 July 2019 (PDT)Ellen Herrick/Edison Design Group
 * Updated. Thanks for your notification! I think you may create an account and ask administrators for changing your membership. --Fruderica (talk) 22:56, 17 July 2019 (PDT)

Possible error in Copy elision page
Hi, I don't have permissions to edit the specific page (or create an account...) so I post this here.

Quoting the paragraph that explains NRVO in the Copy elision page: "In a return statement, when the operand is the name of a non-volatile object with automatic storage duration, which isn't a function parameter or a catch clause parameter, and which is of the same class type (ignoring cv-qualification) as the function return type. This variant of copy elision is known as NRVO, "named return value optimization".

Shouldn't NRVO be allowed for function parameter/catch clause parameter which is given by value?

For example:

template>> decltype(auto) foo(T t)   { return t; //NRVO not allowed?? } 185.175.33.218 16:44, 16 July 2019 (PDT)


 * not allowed because it's not possible: caller places the by-value parameter in its ABI-specified location, and the callee cannot tell the caller to use the return object's location instead. --Cubbi (talk) 05:53, 17 July 2019 (PDT)

C++ compiler support / Embarcadero / std::uncaught_exceptions
Please remove the green box from Embarcaderos collumn on cpp/compiler_support for std::uncaught_exceptions. Currently it's just implemented as.

If you have access you can track the ticket here: https://quality.embarcadero.com/browse/RSP-24850 --82.119.165.2 10:34, 12 July 2019 (PDT)
 * Removed. --Fruderica (talk) 22:53, 17 July 2019 (PDT)

%m
%m in std::get_time seems to require a leading 0 on GCC. Clang does not.24.227.162.35 13:46, 16 July 2019 (PDT)


 * I think this is gcc bug 45896, comment 7 specifically. --Cubbi (talk) 14:05, 16 July 2019 (PDT)

ceilf not part of namespace std
The page cpp/numeric/math/ceil shows the function ceilf as being part of namespace std. This is not how it is implemented in gcc, and attempts to call std::ceilf after including are met with an error, while calls to std::ceil are successful.

Nispio (talk) 19:01, 24 July 2019 (PDT)


 * this is gcc bug 79700. Works with clang (libc++) and MSVC. --Cubbi (talk) 06:12, 25 July 2019 (PDT)