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 » no true Iterator support in Upp???
Re: no true Iterator support in Upp??? [message #28957 is a reply to message #28955] Wed, 29 September 2010 11:28 Go to previous messageGo to previous message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
i'm not too experienced in that all as of now. so this was just state of current knowledge. i remember from c# time, that it has the IEnumerable / IEnumerator helpers that are pretty nice in terms of using foreach keywords on the arbitrary containers. could be a nice feature for upp as well...
this is also the kind of interface i had in mind that did not have eplicit container bonding, once you have obtained an instance of it, you can store it together with same iterators but from other container types..(MT stuff is other topic)

sth like this could be possible:
Vector<int> vi;
Array<int> ai;

Vector<Iterator<int> > iti;
iti << vi.GetIter();
iti << ai.GetIter();

for(int i = 0; i<iti.GetCount(); i++)
{
   Iter<int> & it = iti[i];
   while(it.MoveNext())
   {
   int& ii = it.Current();
   //do stuff with ii, dont care from where element came from 
   }
}



//another thing: with a MACRO stuff like this should be possible:
//    C# syntax
//    foreach( string i in spp)
//            System.Console.WriteLine(i);

Vector<int> vi;
...

      FOREACH(int, i, vi)
          LOG(AsString(i));


see
http://msdn.microsoft.com/en-us/library/ttw7t8t6.aspx
http://msdn.microsoft.com/en-us/library/system.collections.i enumerable.getenumerator.aspx

donno if this is of initeres for upp at all, maybe if one is in need of things like this one should rethink it's design / model, if it's really correct..

upp states with a purpose: "... throw aside some old habbits" Smile
 
Read Message icon5.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Handle a RGBA* with ImageBuffer
Next Topic: Animate does not really animate
Goto Forum:
  


Current Time: Thu Jul 17 23:56:26 CEST 2025

Total time taken to generate the page: 0.02993 seconds