To move this file on C++, a lot of changes have to be done.
To avoid adding a lot of long cast operator in loops, and make too
much changes, this usually replaced by using macros.
This is a non-trivial change and done as a separate cleanup.
See: #103343.
Pull Request: https://projects.blender.org/blender/blender/pulls/109801