Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Plug] Update TF_FOR_ALL to C++11 iterator #3510

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

Cewein
Copy link

@Cewein Cewein commented Jan 31, 2025

Description of Change(s)

Update files under pxr/base/plug by replacing TF_FOR_ALL with C++11-style range-based for each loop.
Additionally, updated pointer usage to align with the new iterator approach, since we now handle references directly rather than raw pointers.

There is C++17 possibility to be used in some cases but this is left for another discussion.

Obgoing Issue(s)

This PR addresses issue #80, though many more instances still need to be resolved. Given the age of this issue (approximately 6–7 years), I wanted to reopen the discussion to evaluate its relevance. Specifically, is the header iterator.h still necessary?

Previous attempts to address this issue (e.g., #396) have been closed without further updates to the thread. I look forward to hearing thoughts on whether we should proceed with this.

Checklist

just like the name say.

For the std::map c++17 could be used.
@nvmkuruc
Copy link
Collaborator

nvmkuruc commented Jan 31, 2025

Specifically, is the header iterator.h still necessary?

The Tf_ProxyReferenceReverseIterator is required until OpenUSD migrates to C++20. I also think there's also not a great drop in replacement for TF_REVERSE_FOR_ALL without std::ranges::views::reverse.

Ranged for otherwise sounds great to me. I would recommend using const TYPE& (or const auto&) whenever possible.

 Using const TYPE& (or const auto&) as recommended.
@nvmkuruc nvmkuruc added build Build-related issue/PR and removed build Build-related issue/PR labels Jan 31, 2025
@jesschimein
Copy link
Collaborator

Filed as internal issue #USD-10625

❗ Please make sure that a signed CLA has been submitted!

(This is an automated message. See here for more information.)

@jesschimein
Copy link
Collaborator

/AzurePipelines run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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.

3 participants