Home » Community » Coffee corner » C++11
Re: C++11 [message #38171 is a reply to message #38150] |
Mon, 03 December 2012 11:04 |
|
mirek
Messages: 14039 Registered: November 2005
|
Ultimate Member |
|
|
Lance wrote on Sun, 02 December 2012 15:00 |
A class not written with pick_ in mind will(or may?) not work correctly with Upp::Vector<>, even if it meets all the interface requirements superficially.
|
Actually, that is not true. pick_ is in no way related with generic requirement of Vector elements (only 2-3 methods require it).
Please note that pick semantics and Moveable are two very different things.
pick indeed is a variant of rvalue and it might have sense to replace it with r-value. Unfortunately, rvalue lacks composition rules, which means that it has to be reimplemented for any composite type, while pick generates compiler generated composite pick operations without problems. How much more code it would mean in practice is something that I plan to test is some branch in future. But e.g. for something like RichTxt::Para, it will be nasty.
Anyway, pick is not used for performance reasons in Vector. Moveable is. And that is still a bit ahead than pick/&&.
Pick is rather interface issue, allows you to pass objects from place to place without copying them (which do not even has to be available).
Mirek
|
|
|
Re: C++11 [message #38172 is a reply to message #38147] |
Mon, 03 December 2012 11:10 |
|
mirek
Messages: 14039 Registered: November 2005
|
Ultimate Member |
|
|
Lance wrote on Sun, 02 December 2012 13:30 | If U++ will adopt rvalue references, will it create the possibility of getting rid of Vector and many other containers/algorithms?
|
Note: You can use most STL algorithms with U++ containers now, as long as elements satisfy STL requirements, and vice versa.
However, sometimes U++ algorithms are better suited for U++ concrete types (and, again, vice versa). For example, U++ Sort is fater than than std::sort for Vector<String>, but slower for std::vector<std::string> (~30%), as there are subtle choices in algorithm that can favor one or another set of types.
Mirek
|
|
|
|
|
|
Goto Forum:
Current Time: Sat Sep 21 06:19:48 CEST 2024
Total time taken to generate the page: 0.04420 seconds
|