From: Dean M. B. <mik...@gm...> - 2008-11-04 15:15:21
|
On Tue, Nov 4, 2008 at 11:08 PM, Rodrigo Madera <rod...@gm...> wrote: >> 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). > > I'm curious, why std::string and not std::vector<char>? > Because std::string and std::vector<char> are effectively the same. Aside from that std::string even has nice substring capabilities and is just very easy to use. Imagine trying to optimize copying of std::vector<char> around -- when std::string has the capability to do copy-on-write. In the next version of the standard though I think will invalidate most of the implementations of std::string with concurrency guarantees, but even then std::string and std::vector<char> will essentially stay mostly equivalent (and std::string makes more semantic sense if you're dealing with a string of characters). -- Dean Michael C. Berris Software Engineer, Friendster, Inc. |