about summary refs log tree commit diff
path: root/absl/hash
diff options
context:
space:
mode:
Diffstat (limited to 'absl/hash')
-rw-r--r--absl/hash/BUILD.bazel2
-rw-r--r--absl/hash/hash.h29
2 files changed, 18 insertions, 13 deletions
diff --git a/absl/hash/BUILD.bazel b/absl/hash/BUILD.bazel
index e1e6eae8516d..8c2daf703bcd 100644
--- a/absl/hash/BUILD.bazel
+++ b/absl/hash/BUILD.bazel
@@ -35,10 +35,10 @@ cc_library(
     copts = ABSL_DEFAULT_COPTS,
     linkopts = ABSL_DEFAULT_LINKOPTS,
     deps = [
+        ":city",
         "//absl/base:core_headers",
         "//absl/base:endian",
         "//absl/container:fixed_array",
-        "//absl/hash:city",
         "//absl/meta:type_traits",
         "//absl/numeric:int128",
         "//absl/strings",
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: