Bug 177568

Summary: default_construct_at
Product: WebKit Reporter: JF Bastien <jfbastien>
Component: Web Template FrameworkAssignee: JF Bastien <jfbastien>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: benjamin, buildbot, cdumez, cmarcelo, darin, dbates, jfbastien, jyasskin, sam
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=177473
Attachments:
Description Flags
patch none

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.