Computer Science Canada For Each - why i cant do this? |
Author: | matt271 [ Fri May 06, 2011 6:32 pm ] | ||
Post subject: | For Each - why i cant do this? | ||
why i cant do this??
|
Author: | Alexmula [ Sat May 07, 2011 2:08 pm ] |
Post subject: | RE:For Each - why i cant do this? |
for the first forEach put a typename before T::iterator and it should work. check out this link http://pages.cs.wisc.edu/~driscoll/typename.html |
Author: | matt271 [ Sat May 07, 2011 5:48 pm ] |
Post subject: | Re: For Each - why i cant do this? |
very cool. ty for that link very helpful |
Author: | matt271 [ Sat May 07, 2011 8:09 pm ] | ||||||||
Post subject: | Re: For Each - why i cant do this? | ||||||||
reading more and playing around i have come up with this:
compile with -std=c++0x flag i think its cool to create a better "for each" in c++0x. i would like to define some macros and stuff to make it even cleaner. also use "where" to make it safer. anybody want to help? my overall goal is to be able to code in c++ (or c++0x) using the shortcuts java has spoiled me with. i would like it to look more like this
or even
to be like javas
|
Author: | Insectoid [ Sat May 07, 2011 9:52 pm ] |
Post subject: | RE:For Each - why i cant do this? |
Better to learn to use C++ as intended rather than try to make it Java. It's a different style that you should learn to use effectively (loving it is a bit much). |
Author: | matt271 [ Sun May 08, 2011 9:21 am ] |
Post subject: | RE:For Each - why i cant do this? |
good point |