Subzero: Use C++11 member initializers where practical.
Also change the pattern "foo() {}" into "foo() = default;" for ctors and dtors.
Generally avoids initializing unique_ptr<> members to nullptr in a .h file, because that requires knowing the definition of the underlying class which may not be available to all includers.
BUG= none
R=jpp@chromium.org
Review URL: https://codereview.chromium.org/1197223002
diff --git a/src/IceTimerTree.h b/src/IceTimerTree.h
index c7cfd6e..17be997 100644
--- a/src/IceTimerTree.h
+++ b/src/IceTimerTree.h
@@ -44,13 +44,13 @@
TimerTreeNode &operator=(const TimerTreeNode &) = delete;
public:
- TimerTreeNode() : Parent(0), Interior(0), Time(0), UpdateCount(0) {}
+ TimerTreeNode() = default;
TimerTreeNode(const TimerTreeNode &) = default;
std::vector<TTindex> Children; // indexed by TimerIdT
- TTindex Parent;
- TimerIdT Interior;
- double Time;
- size_t UpdateCount;
+ TTindex Parent = 0;
+ TimerIdT Interior = 0;
+ double Time = 0;
+ size_t UpdateCount = 0;
};
public:
@@ -81,14 +81,14 @@
IceString Name;
double FirstTimestamp;
double LastTimestamp;
- uint64_t StateChangeCount;
+ uint64_t StateChangeCount = 0;
// IDsIndex maps a symbolic timer name to its integer ID.
std::map<IceString, TimerIdT> IDsIndex;
std::vector<IceString> IDs; // indexed by TimerIdT
std::vector<TimerTreeNode> Nodes; // indexed by TTindex
std::vector<double> LeafTimes; // indexed by TimerIdT
std::vector<size_t> LeafCounts; // indexed by TimerIdT
- TTindex StackTop;
+ TTindex StackTop = 0;
};
} // end of namespace Ice