Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 652182c4 authored by Daniel Zhang's avatar Daniel Zhang
Browse files

No need to std::move local variable to return value



- when no std::move is used, local variable that is returned is directly
  constructed in the address of the return value
- when std::move is used, the return value has to be move constructed
  from the rvalue of std::move, resulting in one more ctor call, not to
  mention the added code complexity
- See Return Value Optimization in Effective Modern C++ by Scott Meyer,
  Item 25

- also delete unrelated outdated comment

Test: compiles and runs
Change-Id: I1b71ea01c6ab1788432e846d9feeb2df608e6b6d
Signed-off-by: default avatarDaniel Zhang <danielzhang130@gmail.com>
parent 7fd8fcb3
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -309,9 +309,8 @@ Asset::Asset(void)
        return NULL;
    }

    // We succeeded, so relinquish control of dataMap
    pAsset->mAccessMode = mode;
    return std::move(pAsset);
    return pAsset;
}

/*
@@ -328,9 +327,8 @@ Asset::Asset(void)
      return NULL;
  }

  // We succeeded, so relinquish control of dataMap
  pAsset->mAccessMode = mode;
  return std::move(pAsset);
  return pAsset;
}

/*