"string"搜索结果 1 条
C++ 的 std::string 有什么缺点?

C++ 的 std::string 有什么缺点?

std::string 与其说是 string,不如说是 ByteArray。事实上许多 C++ 基础组件都把 std::string 当做 ByteArray 来使用,最典型的,比如在 leveldb/rocksdb 中,比如在 snappy 压缩算法中。 这些基础组件不仅把 std::string 当做 ByteArray 使用,还把它当做 OutputByteStream 使用,例如 rocksdb 中就有大量这样的用法,其中一个典型场景是构建 WriteBatch 时,举例来说: Status WriteBatchInternal::Put(WriteBatch* b, uint32…