Boost logo

Boost :

Subject: Re: [boost] rvalue ref best practices?
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2012-06-13 00:50:30


El 13/06/2012 1:08, Ion Gaztañaga escribió:
> 1) s has enough capacity, potentially a single allocation
>
> std::string s;
> s.reserve(largest_path); //one allocation
> std::string ws;
> ws.reserve(largest_path); //one allocation
>
> for( N times )
> {
> calculate_unix_path(s, directory_name, filename[i]...);//no allocation
> ws = to_wide_string(s); //no allocation
> print_s(ws);
> }

Sorry, I meant:

to_wide_string(ws, s); //no allocation


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk