Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Proposal: add Vector::InsertPick(int i, pick_ T&)
Re: Proposal: add Vector::InsertPick(int i, pick_ T&) [message #21201 is a reply to message #21200] Sat, 09 May 2009 09:06 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
This should do the trick:

template <class T>
void Vector<T>::InsertPick(int i, pick_ T& x)
{
	if(!count) return;
	ASSERT(&x < vector || &x > vector + items);
	RawInsert(q, count);
	::new(vector[q]) T(x);
}

template <class T>
void Array<T>::InsertPick(int i, pick_ T& x)
{
	vector.InsertN(i, 1);
	vector[i] = new T(x);
}


Mirek

[Updated on: Sat, 09 May 2009 09:13]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Incorrect ASSERT in Value::Serialize
Next Topic: XmlParser and <![CDATA[
Goto Forum:
  


Current Time: Mon May 20 13:35:29 CEST 2024

Total time taken to generate the page: 0.00582 seconds