Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2004-05-26 08:34:31


Reece Dunn wrote:
>Rob Stewart wrote:
>>From: "Reece Dunn" <msclrhd_at_[hidden]>
>> > To simplify my design, I could implement basic_string_impl using the
>>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


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