Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2005-01-06 20:12:19


At 04:04 PM 1/5/2005, Thorsten Ottosen wrote:
>
>| > 3. Need target-argument form for wstring_convert conversion functions
>| > ---------------------------------------------------------------------
>| >
>| > wstring_convert's conversion functions are in the form:
>| >
>| > byte_string to_bytes(const wide_string& wstr) const;
>| >
>| > While this form is often useful and should be retained, it may imply
an
>| > extra copy of the result if a compiler is not smart enough to
optimize
>the
>| > copy away.
>| > Suggested change is to add additional functions in the form:
>| >
>| > void to_bytes(const wide_string& wstr, byte_string & target)
>const;
>|
>| I prefer output parameters to be first (due to the occasional
>| need to have defaulted parameters and the desire to find output
>| parameters in the same position relative to input parameters).
>| Thus, without meaning to trigger a religious war, I propose this
>| version instead:
>|
>| void to_bytes(byte_string & destination,
>| wide_string const & source) const;
>
>I would prefer these to be free-standing functions.
>Was there something that prohibited that?

No. I was just following the pattern set by the proposal. I'm not sure how
the LWG feels about that; I'll add a mention of the issue so they can
decide. Would you care to add a short rationale?

Thanks for the comment,

--Beman


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