Home » Developing U++ » U++ Developers corner » Should the pick semantics be changed?
Re: Should the pick semantics be changed? [message #42291 is a reply to message #42280] |
Wed, 05 March 2014 08:54   |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
piotr5 wrote on Tue, 04 March 2014 17:14 | have you tried
struct Bar {
int foo;
Vector<int> bar;
Bar(Bar&&)=default;
}; ?
|
Aah, I have to admit I have missed this one...
10 years ago I was discussing && with its original author (Howard Hinnant) over usenet ( http://www.archivum.info/comp.lang.c++.moderated/2005-08/007 08/Re-Rvalue-references--a-done-deal.html) and at that time, the sentiment was against providing this. I am glad it got through in the end.
Well, in this case I believe && could really replace pick_ soon. I will be really be only glad for this to happen... It will be safer and more in accord with C++ mainstream.
But I still believe it is a good idea to keep "pick" behaviour as default (regardless it is implemented as && or ugly pick_ macro) and operator<<= for deep copy. Also, I found over years extremely useful to maintain the source in picked state (not to clear it, as is AFAIK common for C++11 usage).
The only issue I can see now is that for pick types, you have to define twice as much constructors and operator= to keep the current behaviour, you need
T(&)
T(&&)
operator=(&)
operator=(&&)
But that is only a small price to pay...
The other bad thing is that I unfortunately still have to support the "old" C++ now... 
That said, it would perhaps be possible to have U++ "dual-mode", using move constructors with C++11 and pick_ with old C++.
Mirek
|
|
|
 |
|
Should the pick semantics be changed?
By: piotr5 on Tue, 04 March 2014 11:00
|
 |
|
Re: Should the pick semantics be changed?
By: mirek on Tue, 04 March 2014 12:12
|
 |
|
Re: Should the pick semantics be changed?
By: piotr5 on Tue, 04 March 2014 23:14
|
 |
|
Re: Should the pick semantics be changed?
By: mirek on Wed, 05 March 2014 08:54
|
 |
|
Re: Should the pick semantics be changed?
By: piotr5 on Wed, 05 March 2014 10:27
|
 |
|
Re: Should the pick semantics be changed?
By: mirek on Wed, 05 March 2014 12:02
|
 |
|
Re: Should the pick semantics be changed?
By: mirek on Fri, 07 March 2014 09:00
|
 |
|
Re: Should the pick semantics be changed?
By: piotr5 on Fri, 07 March 2014 16:23
|
 |
|
Re: Should the pick semantics be changed?
By: mirek on Fri, 07 March 2014 16:44
|
 |
|
Re: Should the pick semantics be changed?
By: mirek on Sun, 09 March 2014 09:34
|
 |
|
Re: Should the pick semantics be changed?
By: piotr5 on Sun, 09 March 2014 13:28
|
 |
|
Re: Should the pick semantics be changed?
By: Lance on Sun, 23 March 2014 22:02
|
 |
|
Re: Should the pick semantics be changed?
By: piotr5 on Tue, 25 March 2014 19:35
|
 |
|
Re: Should the pick semantics be changed?
By: Lance on Wed, 26 March 2014 02:37
|
 |
|
Re: Should the pick semantics be changed?
By: Lance on Wed, 26 March 2014 02:48
|
 |
|
Re: Should the pick semantics be changed?
By: piotr5 on Wed, 26 March 2014 10:35
|
 |
|
Re: Should the pick semantics be changed?
By: mirek on Wed, 26 March 2014 11:38
|
 |
|
Re: Should the pick semantics be changed?
By: Lance on Wed, 26 March 2014 21:25
|
 |
|
Re: Should the pick semantics be changed?
By: Lance on Wed, 26 March 2014 21:21
|
Goto Forum:
Current Time: Tue Apr 29 16:14:20 CEST 2025
Total time taken to generate the page: 0.00875 seconds
|