Skip to content

Conversation

maliberty
Copy link
Contributor

More modern C++ style

More modern C++ style

Signed-off-by: Matt Liberty <[email protected]>
LibertyCell::leakagePower() const
{
std::optional<float> leakage;
if (leakage_power_exists_) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't necessarily need the leakage value to assign stuff to and simplify that a bit by directly returning the value:

{
  if (leakage_power_exists_) {
     return leakgage_power_;
  }
  return std::nullopt;
}

@hzeller
Copy link
Contributor

hzeller commented Apr 7, 2025

Nice!

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