
Rob Stewart wrote:
From: John Nagle <nagle@overbot.com>
(And you have to supply conversions.) Most strings are sized a bit too big, anyway.
Oh, it just occurred to me that when the two have the same size, there should be a cctor and copy assignment operator to avoid the virtual function call overhead.
The cctor also fixes a bug that caused a pure virtual function run-time error with VC when you have the following: template< size_t n, class C, class CSP > inline fixed_string< n, C, CSP > runtime_error() { fixed_string< n, C, CSP > res( "oops!" ); return( res ); // pure virtual call here } Thanks!
You might even be able to do some metaprogramming to determine whether the capacity of the source string is less than or equal to the capacity of the destination string and avoid the virtual function call overhead for an entire class of copies.
I'll look into this. Regards, Reece _________________________________________________________________ Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo

Reece Dunn wrote:
You might even be able to do some metaprogramming to determine whether the capacity of the source string is less than or equal to the capacity of the destination string and avoid the virtual function call overhead for an entire class of copies.
I wouldn't worry about per-call overhead for whole-string operations. Just make sure that single-character operations, like "operator+=" and "operator[]" are as fast as possible. John Nagle Animats
participants (2)
-
John Nagle
-
Reece Dunn