about summary refs log tree commit diff
path: root/absl/hash/hash.h
diff options
context:
space:
mode:
Diffstat (limited to 'absl/hash/hash.h')
-rw-r--r--absl/hash/hash.h29
1 files changed, 17 insertions, 12 deletions
diff --git a/absl/hash/hash.h b/absl/hash/hash.h
index 339b685ffd20..297dc9cb22ac 100644
--- a/absl/hash/hash.h
+++ b/absl/hash/hash.h
@@ -42,23 +42,28 @@
 //
 // Example:
 //
-//   // Suppose we have a class `Circle` for which we want to add hashing
+//   // Suppose we have a class `Circle` for which we want to add hashing:
 //   class Circle {
-//     public:
-//       ...
-//     private:
-//       std::pair<int, int> center_;
-//       int radius_;
-//     };
-//
-//   // To add hashing support to `Circle`, we simply need to add an ordinary
-//   // function `AbslHashValue()`, and return the combined hash state of the
-//   // existing hash state and the class state:
+//    public:
+//     ...
+//    private:
+//     std::pair<int, int> center_;
+//     int radius_;
+//   };
 //
+//   // To add hashing support to `Circle`, we simply need to add a free
+//   // (non-member) function `AbslHashValue()`, and return the combined hash
+//   // state of the existing hash state and the class state. You can add such a
+//   // free function using a friend declaration within the body of the class:
+//   class Circle {
+//    public:
+//     ...
 //     template <typename H>
 //     friend H AbslHashValue(H h, const Circle& c) {
 //       return H::combine(std::move(h), c.center_, c.radius_);
 //     }
+//     ...
+//   };
 //
 // For more information, see Adding Type Support to `absl::Hash` below.
 //
@@ -239,7 +244,7 @@ using Hash = absl::hash_internal::Hash<T>;
 //     }
 //    private:
 //     virtual void HashValue(absl::HashState state) const = 0;
-//  };
+//   };
 //
 //   class Impl : Interface {
 //    private: