@@ -63,6 +63,18 @@ class Timestamp {
6363 */
6464 Timestamp (int64_t seconds, int32_t nanoseconds);
6565
66+ /* * Copy constructor, `Timestamp` is trivially copyable. */
67+ Timestamp (const Timestamp& other) = default ;
68+
69+ /* * Move constructor, equivalent to copying. */
70+ Timestamp (Timestamp&& other) = default ;
71+
72+ /* * Copy assignment operator, `Timestamp` is trivially copyable. */
73+ Timestamp& operator =(const Timestamp& other) = default ;
74+
75+ /* * Move assignment operator, equivalent to copying. */
76+ Timestamp& operator =(Timestamp&& other) = default ;
77+
6678 /* *
6779 * Creates a new timestamp with the current date.
6880 *
@@ -145,10 +157,16 @@ class Timestamp {
145157 * Returns a string representation of this `Timestamp` for logging/debugging
146158 * purposes.
147159 *
148- * Note : the exact string representation is unspecified and subject to change;
149- * don't rely on the format of the string.
160+ * @note : the exact string representation is unspecified and subject to
161+ * change; don't rely on the format of the string.
150162 */
151163 std::string ToString () const ;
164+
165+ /* *
166+ * Outputs the string representation of this `Timestamp` to the given stream.
167+ *
168+ * @see `ToString()` for comments on the representation format.
169+ */
152170 friend std::ostream& operator <<(std::ostream& out,
153171 const Timestamp& timestamp);
154172
@@ -161,28 +179,34 @@ class Timestamp {
161179 int32_t nanoseconds_ = 0 ;
162180};
163181
182+ /* * Checks whether `lhs` and `rhs` are in ascending order. */
164183inline bool operator <(const Timestamp& lhs, const Timestamp& rhs) {
165184 return lhs.seconds () < rhs.seconds () ||
166185 (lhs.seconds () == rhs.seconds () &&
167186 lhs.nanoseconds () < rhs.nanoseconds ());
168187}
169188
189+ /* * Checks whether `lhs` and `rhs` are in descending order. */
170190inline bool operator >(const Timestamp& lhs, const Timestamp& rhs) {
171191 return rhs < lhs;
172192}
173193
194+ /* * Checks whether `lhs` and `rhs` are in non-ascending order. */
174195inline bool operator >=(const Timestamp& lhs, const Timestamp& rhs) {
175196 return !(lhs < rhs);
176197}
177198
199+ /* * Checks whether `lhs` and `rhs` are in non-descending order. */
178200inline bool operator <=(const Timestamp& lhs, const Timestamp& rhs) {
179201 return !(lhs > rhs);
180202}
181203
204+ /* * Checks `lhs` and `rhs` for inequality. */
182205inline bool operator !=(const Timestamp& lhs, const Timestamp& rhs) {
183206 return lhs < rhs || lhs > rhs;
184207}
185208
209+ /* * Checks `lhs` and `rhs` for equality. */
186210inline bool operator ==(const Timestamp& lhs, const Timestamp& rhs) {
187211 return !(lhs != rhs);
188212}
@@ -213,10 +237,15 @@ std::chrono::time_point<Clock, Duration> Timestamp::ToTimePoint() const {
213237} // namespace firebase
214238
215239namespace std {
240+ /* * Convenience-only specialization of `std::hash`. */
216241template <>
217242struct hash <firebase::Timestamp> {
218- // Note: specialization of `std::hash` is provided for convenience only. The
219- // implementation is subject to change.
243+ /* *
244+ * Hashes the given `timestamp`.
245+ *
246+ * @note: specialization of `std::hash` is provided for convenience only. The
247+ * implementation is subject to change.
248+ */
220249 size_t operator ()(const firebase::Timestamp& timestamp) const ;
221250};
222251} // namespace std
0 commit comments