Skip to content

Conversation

@Skylion007
Copy link
Collaborator

Description

  • I noticed that one of the enum values was using casting a std::pair into a tuple immediately. We can avoid the std::pair -> python tuple cast entirely by just filling the corresponding tuple using pybind11::make_tuple defined in cast.h which is already a dependency. This change serves two purposes:
  1. Make the code more readable by showing that we are just adding a tuple to a python dictionary
  2. Slight code/code gen optimization by removing a temporary std::pair casting.

@Skylion007 Skylion007 requested review from henryiii and rwgk August 1, 2022 17:03
@Skylion007 Skylion007 merged commit 88a1bb9 into pybind:master Aug 1, 2022
@Skylion007 Skylion007 deleted the skylion007/enum-pair-temporary-opt branch August 1, 2022 19:48
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Aug 1, 2022
@Skylion007 Skylion007 removed the needs changelog Possibly needs a changelog entry label Aug 1, 2022
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