Re: [boost] Re: static sized strings

Reece Dunn wrote:
Rob Stewart wrote:
To simplify my design, I could implement basic_string_impl using the
From: "Reece Dunn" <msclrhd@hotmail.com> policy
approach that flex_string uses.
Sorry, I don't know anything about flex_string, but what you've shown would only serve to make your string class more painful than John's (or your) current approach.
I have come up with the following design that should satisfy all requirements.
I have fixed the various naming issues: adding a const version of at(); expanding iter_offset() to begin() and end(); adding a _ at the end of the implementation functions to prevent name hiding and to allow them to be declared private. I have also implemented get_allocator() and switched to a flex_string style policty-based implementation (which resolves several issues and allows for the compiler to better optimize the code). The implementation is still lacking swap, but that is all. This change has not effected the interface I have been using, so you can still do things like: inline void print( boost::char_string & str ) { std::cout << str << '\n'; } int main() { boost::fixed_string< 20 > s; strcpy( s, "Hello " ); // note: this does not work with Borland s += "Meine Welt!"; print( s ); for( boost::fixed_string< 20 >::reverse_iterator i = s.rbegin(); i != s.rend(); ++i ) { std::cout << *i; } std::cout << '\n'; } Regards, Reece _________________________________________________________________ Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo
participants (1)
-
Reece Dunn