|
-
January 8th, 2007, 08:04 AM
#1
flipping a vector?
Hello all,
What is the simplest code to use to "flip" an std::vector? The last element is the first and so on...
Thanks!
-
January 8th, 2007, 08:26 AM
#2
-
January 8th, 2007, 09:11 AM
#3
Re: flipping a vector?
 Originally Posted by lab1
What is the simplest code to use to "flip" an std::vector? The last element is the first and so on...
std::reverse if of course right, but there is hardly ever a need for reversing a vector, because you can iterate a vector back to front as well as front to back. So why waste CPU time on reversing it?
-
January 8th, 2007, 10:49 AM
#4
Re: flipping a vector?
Does std::reverse work on burgers too? I need to know for next time I'm out of computing work.
-
January 8th, 2007, 10:52 AM
#5
Re: flipping a vector?
Maybe you're passing it to a function (that you can't change) that requires it in the opposite order. I had a situation where data was in one order in the application, but an error correction library required it in reverse order. It may be that the data decodes in one order but the reverse makes more logical sense subjectively, and you don't want to use reverse iterators all over the place.
-
January 8th, 2007, 11:11 AM
#6
Re: flipping a vector?
 Originally Posted by NMTop40
Does std::reverse work on burgers too? I need to know for next time I'm out of computing work.
It would probably have to be std::flip
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|