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 » Developing U++ » U++ Developers corner » Core chat... (reference counted pointers etc.)
Re: Core chat... [message #12324 is a reply to message #12323] Wed, 24 October 2007 23:36 Go to previous messageGo to previous message
mdelfede is currently offline  mdelfede
Messages: 1308
Registered: September 2007
Ultimate Contributor
luzr wrote on Wed, 24 October 2007 22:05



Well, in that case, just do not use it:)


Impossible, if some library that I use do use it Razz

Quote:



Well but that is completely different issue altogether... But be sure that Vector code is not badly written Smile


I never thought that Smile That was only an example of how it can be made different. Your Vector::Checksize() can also be made working exponentially, just drop the second argument and change code inside it... even more easy to use.
a.CheckSize(i);
a[i] = i;

in previous example. The matter doesn't change. All you spare with At() is a line of code at a cost of the danger of hidden bugs.....

Quote:


Growing by static chunks is very stupid method. You always need exponential growth - this is the same for NTL and STL. In that case, the total number of copying stuff is amortized constant - both for STL and NTL (but for NTL, unlike STL, the copy of Vector element is performed by raw binary move, which can be much faster).


I told you that I'm not the boggest fan of STL Smile

Quote:


Current At method is more optimal.


More than my example with linear/constant growth, ok.
But with exponential growth, all you spare is a line of code.

Quote:


Why should you duplicate operator[] with a method?


You shouldn't. If the only purpose of At() is allow creating elements on the fly just before accessing them, I see on it no true benefit, besides some 20 keystrokes less typing.

Quote:


BTW, if you want to study easy to undestand practical examples of using At, look at ArrayCtrl::SetDisplay or Switch::Set.


I'll look for it next days, thanx !

Ciao

Max
 
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
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: ValueMap
Next Topic: Quick and dirty solution to .icpp problem...
Goto Forum:
  


Current Time: Sat May 10 07:11:04 CEST 2025

Total time taken to generate the page: 0.03562 seconds