From: Reece Dunn (msclrhd_at_[hidden])
Date: 2004-06-21 07:46:35
John Nagle wrote:
>Reece Dunn wrote:
>>John Nagle wrote:
>>The problems arise in the interation with basic_string_impl and how to
>>implement swap and functions that require constructing a string object.
>Why do you need to construct a string object to swap?
>Just swap one character at a time.
There were 3 things I was cxonsidering when moving to the non-virtual
 How do I pass the buffer and capacity to the implementation while
allowing both fixed_string_base and fixed_string access to the basic_string
interface? I have chosen to route the data through one of the basic_string
constructors, requiring a const_cast. This is the best approach AFAICS.
 How do I implement the swap function? The solution I arrived at is the
one you suggest: to swap the data character-by-character. What you have to
consider when doing this is that the strings don't exceed capacity,
resulting in additional logic.
 How do I approach the substr function and the + operators? Although it
is now possible to construct a fixed_string_base object from a fixed_string
object, you will run into problems when constructing from a temporary
(because the fixed_string temporary will have been destroyed, invalidating
Given this, the implementation of these functions are still in fixed_string
and thus not accessible to [w]char_string.
I have replaced the old implementation with this one in the sandbox if you
want to take a look. Also, feel free to adapt it to your version if you
It's fast, it's easy and it's free. Get MSN Messenger today!
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk