Original Post
Hi, I am trying to avoid "redundant" allocations on the heap while converting strings from Unicode to ANSI and vice versa. Is it safe to directly write to const_cast( std::string.c_str() ) and &std::vector[0], after resize()ing them to the approbiate length? Or should I maybe use boost::pool_allocator, to reduce the heap allocation overhead? Or possibly alloca()? Another question, is there a method to construct a std::string from a new[] allocated array, in a way that std::string assumes ownership (and disposes of) the pointer? (I guess not)