Bug 177568 - default_construct_at
Summary: default_construct_at
Status: RESOLVED DUPLICATE of bug 177473
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: JF Bastien
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-27 14:08 PDT by JF Bastien
Modified: 2017-11-27 10:03 PST (History)
9 users (show)

See Also:


Attachments
patch (1.60 KB, patch)
2017-09-27 14:10 PDT, JF Bastien
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description JF Bastien 2017-09-27 14:08:13 PDT
https://bugs.webkit.org/show_bug.cgi?id=177473 has so pretty ugly code to default construct a generic ArrayPtr<T>:

  new (&container.get()[i]) std::remove_reference_t<decltype(*container.get())>();

Let's add default_construct_at, which jyasskin suggested I do.
Comment 1 JF Bastien 2017-09-27 14:10:33 PDT
Created attachment 322015 [details]
patch
Comment 2 Build Bot 2017-09-27 14:12:08 PDT
Attachment 322015 [details] did not pass style-queue:


ERROR: Source/WTF/wtf/StdLibExtras.h:164:  default_construct_at is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 JF Bastien 2017-09-28 11:34:43 PDT
cdumez suggested I do this change straight in #177473 and use it there. Closing to do that instead.

*** This bug has been marked as a duplicate of bug 177473 ***
Comment 4 Darin Adler 2017-11-22 11:30:00 PST
Comment on attachment 322015 [details]
patch

Unlike the others who commented on this, I do think this might possibly make some call sites a little easier to read, and why not get on board now if it’s the future of C++ anyway. But I don’t think we should land the change without using it anywhere.
Comment 5 Darin Adler 2017-11-22 11:30:20 PST
Oh, this bug is obsolete. Clearing the flags.
Comment 6 JF Bastien 2017-11-27 10:03:32 PST
(In reply to Darin Adler from comment #4)
> Comment on attachment 322015 [details]
> patch
> 
> Unlike the others who commented on this, I do think this might possibly make
> some call sites a little easier to read, and why not get on board now if
> it’s the future of C++ anyway. But I don’t think we should land the change
> without using it anywhere.

I liked it too, it made the sample code way more readable, but it's admittedly a rare thing so I'm happy not pushing it and leaving the obscure placement new code as-is.