• Giuseppe Ottaviano's avatar
    Add IOBuf convenience methods to convert to std::string · a79234f0
    Giuseppe Ottaviano authored
    Summary:
    Getting an `std::string` out of the data in a `IOBuf` chain is a common operation in tests, logging, and at interface boundaries. Currently there isn't an easy way to do it, so either the same boilerplate is replicated everywhere, or people resort to `coalesce().str()`, which is inefficient (it can end up copying the data twice) and non-`const`.
    
    Add methods to append and convert to any char container, like `string`, `fbstring`, `vector<char>`, ...
    
    Reviewed By: philippv
    
    Differential Revision: D31385345
    
    fbshipit-source-id: 8a331771786f7bf1043b59d5c36ac4051e442531
    a79234f0
IOBuf.cpp 42.9 KB