Skip to content

chore: document TrimWhitespace string_view lifetime requirement#60

Merged
codepuncher merged 1 commit into
mainfrom
chore/document-trimwhitespace-lifetime
Jun 20, 2026
Merged

chore: document TrimWhitespace string_view lifetime requirement#60
codepuncher merged 1 commit into
mainfrom
chore/document-trimwhitespace-lifetime

Conversation

@codepuncher

Copy link
Copy Markdown
Owner

TrimWhitespace returns a std::string_view into its input buffer. Calling it with a temporary (e.g. TrimWhitespace(std::string{"..."})) produces a dangling view. Documents the lifetime requirement so callers don't misuse it.

Comment-only change; no behavioral impact.

Copilot AI review requested due to automatic review settings June 20, 2026 12:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Documents the lifetime requirement of TrimWhitespace, which returns a std::string_view into its input buffer, to help prevent callers from accidentally creating dangling views (e.g., by passing a temporary std::string).

Changes:

  • Added a clarifying comment explaining that TrimWhitespace returns a view into the input and the input buffer must outlive the returned std::string_view.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codepuncher codepuncher force-pushed the chore/document-trimwhitespace-lifetime branch from c9e9ae2 to a281897 Compare June 20, 2026 12:23
@codepuncher codepuncher merged commit f5791c8 into main Jun 20, 2026
10 checks passed
@codepuncher codepuncher deleted the chore/document-trimwhitespace-lifetime branch June 20, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants