From: Dean M. B. <mik...@gm...> - 2008-11-04 09:28:31
|
On Tue, Nov 4, 2008 at 12:03 AM, Rodrigo Madera <rod...@gm...> wrote: > > On Mon, Nov 3, 2008 at 3:32 AM, Dean Michael Berris <mik...@gm...> > wrote: >> >> >> BTW, strings can contain binary data just fine (as long as you store >> the data (7-bit chars) as is). > > So are you saying that storing a binary block of data (say an image) into a > string is okay? Yes, it's okay. > Boost has a buffer class made for this. If you want integration with boost > you need to use boost. > What "buffer" class are you talking about? Are you talking about Boost.Array? Because the last time I checked, Boost.Array is statically-sized and is not as flexible as an std::string. IMO, using something from the STL is "better" because you don't need to rely on Boost being there to use the library. I won't even be surprised if it was possible to package the header-only Boost libs with cpp-netlib as a "standalone" download (with the help perhaps of bcp). Of course if we're using Boost.Asio we rely on Boost.System -- but other than that I'm confident there shouldn't be a lot of other libraries cpp-netlib would rely on (of course aside from the STL). > It makes no sense at all to put strings into every message. > Why doesn't it make sense? A message would consist of bytes -- the easiest way to deal with bytes is to use std::string. If you needed a different representation, you can always specialize the basic_message<> to your tag and use your own storage representation. The documentation shows you how to do that IIRC. -- Dean Michael C. Berris Software Engineer, Friendster, Inc. |