Re: [PATCH 1/4] msvcp90: Added basic_string<char>::swap implementation. (try 2)
15 Nov
2010
15 Nov
'10
10:28 p.m.
On 11/15/10 18:26, Vincas Miliƫnas wrote:
The way I see this is that the code above handles the case when lhs string is in the local buffer and rhs is allocated. The exchange requires copying (lhs->data->buf into rhs->data->buf and rhs->data->ptr into lhs->data->ptr), since setting one's ptr to other's buf would be illegal. Also, the ptr and buf are in an union construct and overlap, therefore only one can be stored at a time. You can copy whole union without knowing what field is used. This way you can implement it with only one else statement.
+ if (this == str) + { Please try to follow coding style used in modified file (no space after if, new block bracket in the same line).
5509
Age (days ago)
5509
Last active (days ago)
0 comments
1 participants
participants (1)
-
Piotr Caban