From: Rainer Deyke (root_at_[hidden])
Date: 2002-02-05 10:33:36
----- Original Message -----
From: "Howard Hinnant" <hinnant_at_[hidden]>
Sent: Monday, February 04, 2002 7:40 PM
Subject: Re: [boost] auto_vector - vector with auto_ptr semantics
> How 'bout:
> std::vector<int> g()
> std::vector<int> first, second;
> // Do various operations on 'first' and 'second' here.
> return std::vector<int>(std::move(first.size() > second.size() ?
> first : second));
> std::vector<int> v(std::move(g()));
That would have the intended behavior on a sufficiently optimizing
compiler, but it's overly verbose and it does not maintain the
no-throw guarantee, since the compiler is not required to optimize
away the copy.
-- Rainer Deyke | root_at_[hidden] | http://rainerdeyke.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk