diff options
Diffstat (limited to 'include/grpc++/impl/codegen/slice.h')
-rw-r--r-- | include/grpc++/impl/codegen/slice.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/grpc++/impl/codegen/slice.h b/include/grpc++/impl/codegen/slice.h index 7280698978..e79754f943 100644 --- a/include/grpc++/impl/codegen/slice.h +++ b/include/grpc++/impl/codegen/slice.h @@ -44,6 +44,11 @@ inline grpc::string_ref StringRefFromSlice(grpc_slice slice) { GRPC_SLICE_LENGTH(slice)); } +inline grpc::string StringFromCopiedSlice(grpc_slice slice) { + return grpc::string(reinterpret_cast<char*>(GRPC_SLICE_START_PTR(slice)), + GRPC_SLICE_LENGTH(slice)); +} + inline grpc_slice SliceReferencingString(const grpc::string& str) { return g_core_codegen_interface->grpc_slice_from_static_buffer(str.data(), str.length()); |