|
|||||||||||
|
Re: Bug: char[]s not escaped
From: Jonathan Wakely <jonathan.wakely(at)gmail.com>
Date: Tue Jul 03 2007 - 20:20:46 EDT
Personally I would use simply static_cast<cont char*>(in) if doing that. It is a direct conversion from char[] to char* and last time I saw any benchmarks it was cheaper to copy a pointer a reference (and it will be copied by value when passed to the operator<< function anyway.) The assembly code shows five instructions for the reference version and two otherwise. Alternatively, something like
template <int N>
return o.ostr->write(in, N-1); // don't write nul terminator } You know the size of the array, why discard that info and require a strlen call? The const overloads aren't needed, char[N] will match const char[N] rather than the default specialisation, so you only need one overload for quote_type1 and one for escape_type1. Jon -- MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: http://lists.mysql.com/plusplus?unsub=lists@pantek.comReceived on Tue Jul 3 20:21:11 2007 This archive was generated by hypermail 2.1.8 : Tue Jul 03 2007 - 20:30:02 EDT |
||||||||||
|
|||||||||||