mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-28 20:25:33 +08:00
Fabric: Unifying usage of autos
Summary: I was watching a classic magnificent talk about modern C++ by Herb Sutter and I was totally sold on double down on using `auto` in our codebase. Surprisingly, 95% of the code base already follows Herb's guidence; I just changed the last 5% to make it consistent. All those changes must work *exactly* like it was before. The talk: https://youtu.be/xnqTKD8uD64?t=28m25s Reviewed By: mdvacca Differential Revision: D9753301 fbshipit-source-id: 9629aa485a5d6e51806cc96306c297284d4f90b8
This commit is contained in:
committed by
Facebook Github Bot
parent
37d19aaae3
commit
9570d7d490
@@ -56,13 +56,13 @@ std::string DebugStringConvertible::getDebugPropsDescription(DebugStringConverti
|
||||
}
|
||||
|
||||
std::string DebugStringConvertible::getDebugDescription(DebugStringConvertibleOptions options, int depth) const {
|
||||
std::string nameString = getDebugName();
|
||||
std::string valueString = getDebugValue();
|
||||
std::string childrenString = getDebugChildrenDescription(options, depth);
|
||||
std::string propsString = getDebugPropsDescription(options, depth);
|
||||
auto nameString = getDebugName();
|
||||
auto valueString = getDebugValue();
|
||||
auto childrenString = getDebugChildrenDescription(options, depth);
|
||||
auto propsString = getDebugPropsDescription(options, depth);
|
||||
|
||||
std::string leading = options.format ? std::string(depth * 2, ' ') : "";
|
||||
std::string trailing = options.format ? "\n" : "";
|
||||
auto leading = options.format ? std::string(depth * 2, ' ') : std::string {""};
|
||||
auto trailing = options.format ? std::string {"\n"} : std::string {""};
|
||||
|
||||
return leading + "<" + nameString +
|
||||
(valueString.empty() ? "" : "=" + valueString) +
|
||||
|
||||
@@ -45,7 +45,7 @@ inline SharedDebugStringConvertible debugStringConvertibleItem(std::string name,
|
||||
}
|
||||
|
||||
inline SharedDebugStringConvertibleList operator+(const SharedDebugStringConvertibleList &lhs, const SharedDebugStringConvertibleList &rhs) {
|
||||
SharedDebugStringConvertibleList result = {};
|
||||
auto result = SharedDebugStringConvertibleList {};
|
||||
std::move(lhs.begin(), lhs.end(), std::back_inserter(result));
|
||||
std::move(rhs.begin(), rhs.end(), std::back_inserter(result));
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user