Refactor buildDate() to use string_views #51
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
Yo
2E29
u must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Template
Summary
Build::buildDate()
utility function to usestd::string_view
s for performance and safety, and adds test cases to verify the functionality.Changes
Build::buildDate()
Build::buildDate()
to usestd::string_view
as a parameter and for intermediate variablesstatic const
array ofstd::string
to be astatic constexpr
array ofstd::string_view
.Motivation
Build::buildDate()
function is called.static constexpr std::string_view
s are initialized at compile-time instead of run-time.Testing
Build::buildDate()
, so I added one that tests the date "Jan 2, 1970".Checklist
Additional Comments
std::string
s intostd::string_view
s but I'm unsure of whether this'd be welcome, so I haven't included commits updating the style guide.