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 » why not "T & Add(const T & x)" in all containers
Re: why not "T & Add(const T & x)" in all containers [message #28101 is a reply to message #27998] Mon, 16 August 2010 09:06 Go to previous messageGo to previous message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
it's actually the same behaviour as with T& Array::Attach(T* newt);
and merly a logical unification of interface, that anything that ends beeing an object, no matter newly added or as copy, should be instantly available, without the need to again access the container to get the same. here, it actually doesnt matter the container type, it's same situation for Vector and Array.

a practical use is this:

crating new container objects, based on some 'template' objects, and remodifying stuff that is actually different, on the new created object, pushing it somewhere to do something. this would use in case of Array:
void Array::Add(cibst T&),
then
T& Array::operator[](int i) with Array::GetCount()-1.
actually 3 invokations, that could be done in one.

it's maybe more of estetic use Smile but could again add to Ultimate's short and reading friendly code
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: InitCaps() proposal
Next Topic: Incorrect implementation of INITBLOCK (and similar macros) in case when flagBLITZ is not defined.
Goto Forum:
  


Current Time: Mon Aug 25 02:29:48 CEST 2025

Total time taken to generate the page: 0.04365 seconds