Home » U++ Library support » U++ Core » Proposal: add Vector::InsertPick(int i, pick_ T&)
Re: Proposal: add Vector::InsertPick(int i, pick_ T&) [message #21198 is a reply to message #21194] |
Sat, 09 May 2009 00:05   |
Mindtraveller
Messages: 917 Registered: August 2007 Location: Russia, Moscow rgn.
|
Experienced Contributor |

|
|
luzr wrote on Fri, 08 May 2009 23:21 |
Mindtraveller wrote on Fri, 08 May 2009 04:30 | Actually it doesn`t. Differences are:
- you require M to have default constructor, which is not strong requirement for Vector element
|
1. Does it?
Quote: |
- you have one redundant call (ctor and operator= instead of ctor), which sometimes is crucial (picking was made for efficiency, right?)
And IMO this code is little bit less clear than plain v.InsertPick(a).
|
2. While I can agree with symmetry point and clarity issue, I do not see how adding InsertPick should solve above problem.
3. Maybe you can rewrite mrjt's example with InsertPick?
Mirek
|
1. I`m not quite shure I understand what you mean by this question.
If I understand correctly and the question is about default ctor requirement, TheIDE help says:
Quote: | General requirement: T is required to be moveable and must have either deep copy constructor, pick constructor or default constructor.
AddPick requirement: void AddPick(pick_ T& x)
Adds new element to Vector and picks value of parameter to it.
Requires T to have pick constructor.
|
-- so it is not necessary for M to have default /deep copy ctor to have Vector<M> and do AddPick.
2. I hope that InsertPick won`t make me writing default constructors or optional deep copy to insert element into queue. This should solve the problem with deep copy where I want to pick only.
3.Vector<M> v;
M a;
..
v.InsertPick(a);
Or maybe you mean InsertPick(int i, pick_ Vector<M> &) ?
[Updated on: Sat, 09 May 2009 00:09] Report message to a moderator
|
|
|
 |
|
Proposal: add Vector::InsertPick(int i, pick_ T&)
|
 |
|
Re: Proposal: add Vector::InsertPick(int i, pick_ T&)
By: mrjt on Fri, 08 May 2009 10:07
|
 |
|
Re: Proposal: add Vector::InsertPick(int i, pick_ T&)
|
 |
|
Re: Proposal: add Vector::InsertPick(int i, pick_ T&)
By: mirek on Fri, 08 May 2009 21:21
|
 |
|
Re: Proposal: add Vector::InsertPick(int i, pick_ T&)
|
 |
|
Re: Proposal: add Vector::InsertPick(int i, pick_ T&)
By: mirek on Sat, 09 May 2009 09:02
|
 |
|
Re: Proposal: add Vector::InsertPick(int i, pick_ T&)
By: mirek on Sat, 09 May 2009 09:06
|
 |
|
Re: Proposal: add Vector::InsertPick(int i, pick_ T&)
|
 |
|
Re: Proposal: add Vector::InsertPick(int i, pick_ T&)
By: hans on Sun, 10 May 2009 19:56
|
 |
|
Re: Proposal: add Vector::InsertPick(int i, pick_ T&)
By: mirek on Sun, 10 May 2009 23:11
|
Goto Forum:
Current Time: Fri Jul 18 07:37:24 CEST 2025
Total time taken to generate the page: 0.03217 seconds
|