Page MenuHome

Cycles X: Switch startswith/endswith to string_view
ClosedPublic

Authored by Sergey Sharybin (sergey) on Sep 14 2021, 2:59 PM.

Details

Summary

Currently no functional changes. Making this internal API flexible to
be used for any string-like objects.

The implementation is a bit lower-level than one would expect from the
C++'s string_view. This is because the string_view implementation is
coming from OIIO./

Diff Detail

Repository
rB Blender

Event Timeline

Sergey Sharybin (sergey) requested review of this revision.Sep 14 2021, 2:59 PM
Sergey Sharybin (sergey) created this revision.
This revision is now accepted and ready to land.Sep 14 2021, 3:11 PM
William Leeson (leesonw) requested changes to this revision.Sep 14 2021, 3:21 PM

The prototype for the functions seem to differ from the implementation.

intern/cycles/util/util_string.h
55–57

proto differs from the implementation in the cpp file.

This revision now requires changes to proceed.Sep 14 2021, 3:21 PM

This is intentional. In this case the const does not affect the signature of the function, and is only used to ensure definition does not modify arguments.
This also follows the Clang-Tidy readability: https://clang.llvm.org/extra/clang-tidy/checks/readability-avoid-const-params-in-decls.html

This revision is now accepted and ready to land.Sep 14 2021, 4:07 PM