Topic: Swapping valarrays?
Author: Howard Hinnant <hinnant@antispam.metrowerks.com>
Date: Sun, 28 Oct 2001 13:27:34 GMT Raw View
In article <3BD76CB3.9D76F471@wizard.net>, James Kuyper Jr.
<kuyper@wizard.net> wrote:
| Daryle Walker wrote:
| >
| > Could we add a swap member function for the std::valarray class
| > template? There can be a special std::swap function template for
| > valarrays that uses the member function. Right now, switching values
| > takes a lot of work with explicit resizings (and exceptions).
|
| I don't understand - why do you expect that a member function would have
| any advantage over the default implementation of
| std::swap<std::valarray<T> >()?
I don't understand why you would not expect Daryle's suggested swap to
have an advantage.
If I'm not mistaken Daryle believes that swap on valarray could become
constant complexity instead of linear. I'm inclined to agree with
Daryle. But perhaps if you elaborated on your position, my
understanding of the situation would improve.
--
Howard Hinnant
Metrowerks
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]
Author: Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
Date: Mon, 29 Oct 2001 22:02:52 GMT Raw View
dwalker07@snet.net.invalid (Daryle Walker) writes:
| Could we add a swap member function for the std::valarray class
| template? There can be a special std::swap function template for
| valarrays that uses the member function. Right now, switching values
| takes a lot of work with explicit resizings (and exceptions).
I don't see any serious objection to your wish-list. Certainly
something to be raised for the next version of C++.
--
Gabriel Dos Reis, dosreis@cmla.ens-cachan.fr
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]
Author: dwalker07@snet.net.invalid (Daryle Walker)
Date: Wed, 24 Oct 2001 15:54:10 GMT Raw View
Could we add a swap member function for the std::valarray class
template? There can be a special std::swap function template for
valarrays that uses the member function. Right now, switching values
takes a lot of work with explicit resizings (and exceptions).
--
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]
Author: "James Kuyper Jr." <kuyper@wizard.net>
Date: Thu, 25 Oct 2001 01:25:25 GMT Raw View
Daryle Walker wrote:
>
> Could we add a swap member function for the std::valarray class
> template? There can be a special std::swap function template for
> valarrays that uses the member function. Right now, switching values
> takes a lot of work with explicit resizings (and exceptions).
I don't understand - why do you expect that a member function would have
any advantage over the default implementation of
std::swap<std::valarray<T> >()?
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]