Creates an absl::string_view from a pointer p even if it's null‐valued.

Synopsis

Declared in <absl/strings/string_view.h>

constexpr
std::string_view
NullSafeStringView(char const* p);

Description

This function should be used where an absl::string_view can be created from a possibly‐null pointer.

Return Value

A view of p, or an empty view if p is null.

Parameters

Name

Description

p

The possibly‐null pointer to create a view from.

Created with MrDocs