POV-Ray : Newsgroups : povray.off-topic : Swapping vector elements : Re: Swapping vector elements Server Time
28 Jul 2024 14:28:36 EDT (-0400)
  Re: Swapping vector elements  
From: clipka
Date: 14 Jan 2014 21:06:39
Message: <52d5ed2f$1@news.povray.org>
Am 14.01.2014 22:21, schrieb Orchid Win7 v1:
> OK, so we have a std::vector of pointers to task objects. How do we swap
> a pair of elements to change their order?
>
> Half the Internet claims this is std::swap(), the other half claim it's
> std::swap_iter(), and a few people claim it's something else again...

 From the names of those function, I'd suspect both to be right: 
std::swap_iter() probably works on arbitrary containers but requires you 
to obtain an iterator first, while std::swap() might just need numeric 
indices but be limited to std::vector.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.