Re: [webkit-dev] Watch out for std::optional's move constructor

2018-12-14 Thread David Kilzer
Filed: Dave On Dec 14, 2018, at 2:18 PM, Adrian Perez de Castro wrote: > Hello, > > On Fri, 14 Dec 2018 14:02:39 -0800, Saam Barati wrote: > >>> On Dec 14, 2018, at 1:59 PM, Chris Dumez wrote: >>> On Dec 14, 2018, at 1:56 PM, Saam Bar

Re: [webkit-dev] Watch out for std::optional's move constructor

2018-12-14 Thread Fujii Hironori
On Sat, Dec 15, 2018 at 8:46 AM Chris Dumez wrote: > > > This is the latest one: https://trac.webkit.org/changeset/239228/webkit > This expression WTFMove(*m_pendingWebsitePolicies) doesn't move std::optional, but moves the content of the std::optional, WebsitePoliciesData. I think your proposal

Re: [webkit-dev] Watch out for std::optional's move constructor

2018-12-14 Thread Chris Dumez
So to be clear, it is often not truly about using the value after it is moved. It is about expecting that the variable / member has been nulled out after moving it. If I WTFMove() out a data member m_dataMember, I expect later on `if (m_dataMember)` to be false. --  Chris Dumez > On Dec 14

Re: [webkit-dev] Watch out for std::optional's move constructor

2018-12-14 Thread Chris Dumez
> On Dec 14, 2018, at 3:39 PM, Fujii Hironori wrote: > > > On Sat, Dec 15, 2018 at 6:38 AM Chris Dumez > wrote: > > I have now been caught twice by std::optional’s move constructor. > > I don't understand how this could be useful? Do you want to use the value > af

Re: [webkit-dev] Watch out for std::optional's move constructor

2018-12-14 Thread Fujii Hironori
On Sat, Dec 15, 2018 at 6:38 AM Chris Dumez wrote: > > I have now been caught twice by std::optional’s move constructor. > I don't understand how this could be useful? Do you want to use the value after it is moved? I'd like to see these your code. Could you show me these two patches? _

Re: [webkit-dev] Watch out for std::optional's move constructor

2018-12-14 Thread youenn fablet
Is it too late to ask for a std::optional change? Le ven. 14 déc. 2018 à 13:37, Chris Dumez a écrit : > > Hi, > > I have now been caught twice by std::optional’s move constructor. It turns > out that it leaves the std::optional being moved-out *engaged*, it merely > moves its value. > > For exa

Re: [webkit-dev] Watch out for std::optional's move constructor

2018-12-14 Thread Adrian Perez de Castro
Hello, On Fri, 14 Dec 2018 14:02:39 -0800, Saam Barati wrote: > > On Dec 14, 2018, at 1:59 PM, Chris Dumez wrote: > > > >> On Dec 14, 2018, at 1:56 PM, Saam Barati >> > wrote: > >> > >>> On Dec 14, 2018, at 1:54 PM, Saam Barati >>> > wrot

Re: [webkit-dev] Watch out for std::optional's move constructor

2018-12-14 Thread Saam Barati
> On Dec 14, 2018, at 1:59 PM, Chris Dumez wrote: > >> >> On Dec 14, 2018, at 1:56 PM, Saam Barati > > wrote: >> >> >> >>> On Dec 14, 2018, at 1:54 PM, Saam Barati >> > wrote: >>> >>> >>> On Dec 14, 2018, at 1:37 PM, Chris Dumez >>

Re: [webkit-dev] Watch out for std::optional's move constructor

2018-12-14 Thread Chris Dumez
> On Dec 14, 2018, at 1:56 PM, Saam Barati wrote: > > > >> On Dec 14, 2018, at 1:54 PM, Saam Barati > > wrote: >> >> >> >>> On Dec 14, 2018, at 1:37 PM, Chris Dumez >> > wrote: >>> >>> Hi, >>> >>> I have now been caught twice by std::opti

Re: [webkit-dev] Watch out for std::optional's move constructor

2018-12-14 Thread Saam Barati
> On Dec 14, 2018, at 1:54 PM, Saam Barati wrote: > > > >> On Dec 14, 2018, at 1:37 PM, Chris Dumez > > wrote: >> >> Hi, >> >> I have now been caught twice by std::optional’s move constructor. It turns >> out that it leaves the std::optional being moved-out *engage

Re: [webkit-dev] Watch out for std::optional's move constructor

2018-12-14 Thread Saam Barati
> On Dec 14, 2018, at 1:37 PM, Chris Dumez wrote: > > Hi, > > I have now been caught twice by std::optional’s move constructor. It turns > out that it leaves the std::optional being moved-out *engaged*, it merely > moves its value. > > For example, testOptional.cpp: > #include > #include

[webkit-dev] Watch out for std::optional's move constructor

2018-12-14 Thread Chris Dumez
Hi, I have now been caught twice by std::optional’s move constructor. It turns out that it leaves the std::optional being moved-out *engaged*, it merely moves its value. For example, testOptional.cpp: #include #include int main() { std::optional a = 1; std::optional b = std::move(a);