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 #27847 is a reply to message #27844] Fri, 06 August 2010 11:48 Go to previous messageGo to previous message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
the usage pattern is not changed too much in fact. all the functions changed (in code provided) returned void by before. so it's more of an extension..

the 'new' usage pattern would be, get direct access to the object, that 'somehow' has been added / replaced (Set) / or inserted. because it exists in container after the call, beeing it the same or a copy, the user wouldnt need to care. it is the one that remains in the container (maybe could even be more logic).

this would spare the usage of Top() or even operator[](GetCount()-1) like in some places, after having void Add(const & T x). this by the way uses the rather 'implicit' assumption that an added item is always placed last...
 
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 10:56:52 CEST 2025

Total time taken to generate the page: 0.08713 seconds