diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-07-01 06:12:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-07-01 06:12:24 +0300 |
commit | 36d6aa428f4848cfb153b34bdc4921ee9cabb227 (patch) | |
tree | 90f196216950be2c5b2221df1faeb01e80902de0 /source/blender/blenlib/BLI_hash.hh | |
parent | 63b8cf45187edd5f68486773119c8385ac4bc277 (diff) |
Cleanup: spelling
Diffstat (limited to 'source/blender/blenlib/BLI_hash.hh')
-rw-r--r-- | source/blender/blenlib/BLI_hash.hh | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/source/blender/blenlib/BLI_hash.hh b/source/blender/blenlib/BLI_hash.hh index 5490c953756..49e619ff1bc 100644 --- a/source/blender/blenlib/BLI_hash.hh +++ b/source/blender/blenlib/BLI_hash.hh @@ -23,7 +23,7 @@ * A specialization of `blender::DefaultHash<T>` provides a hash function for values of type T. * This hash function is used by default in hash table implementations in blenlib. * - * The actual hash function is in the `operator()` method of DefaultHash<T>. The following code + * The actual hash function is in the `operator()` method of `DefaultHash<T>`. The following code * computes the hash of some value using DefaultHash. * * T value = ...; @@ -32,17 +32,17 @@ * * Hash table implementations like blender::Set support heterogeneous key lookups. That means that * one can do a lookup with a key of type A in a hash table that stores keys of type B. This is - * commonly done when B is std::string, because the conversion from e.g. a StringRef to std::string - * can be costly and is unnecessary. To make this work, values of type A and B that compare equal - * have to have the same hash value. This is achieved by defining potentially multiple `operator()` - * in a specialization of DefaultHash. All those methods have to compute the same hash for values - * that compare equal. + * commonly done when B is std::string, because the conversion from e.g. a #StringRef to + * std::string can be costly and is unnecessary. To make this work, values of type A and B that + * compare equal have to have the same hash value. This is achieved by defining potentially + * multiple `operator()` in a specialization of #DefaultHash. All those methods have to compute the + * same hash for values that compare equal. * * The computed hash is an unsigned 32 bit integer. Ideally, the hash function would generate * uniformly random hash values for a set of keys. However, in many cases trivial hash functions * are faster and produce a good enough distribution. In general it is better when more information * is in the lower bits of the hash. By choosing a good probing strategy, the effects of a bad hash - * function are less noticable though. In this context a good probing strategy is one that takes + * function are less noticeable though. In this context a good probing strategy is one that takes * all bits of the hash into account eventually. One has to check on a case by case basis to see if * a better but more expensive or trivial hash function works better. * @@ -50,11 +50,11 @@ * * - When you want to provide a default hash function for your own custom type: Add a `hash` * member function to it. The function should return `uint32_t` and take no arguments. This - * method will be called by the default implementation of DefaultHash. It will automatically be + * method will be called by the default implementation of #DefaultHash. It will automatically be * used by hash table implementations. * * - When you want to provide a default hash function for a type that you cannot modify: Add a new - * specialization to the DefaultHash struct. This can be done by writing code like below in + * specialization to the #DefaultHash struct. This can be done by writing code like below in * either global or BLI namespace. * * template<> struct blender::DefaultHash<TheType> { @@ -86,9 +86,9 @@ namespace blender { /** - * If there is no other specialization of DefaultHash for a given type, try to call `hash()` on the - * value. If there is no such method, this will result in a compiler error. Usually that means that - * you have to implement a hash function using one of three strategies listed above. + * If there is no other specialization of #DefaultHash for a given type, try to call `hash()` on + * the value. If there is no such method, this will result in a compiler error. Usually that means + * that you have to implement a hash function using one of three strategies listed above. */ template<typename T> struct DefaultHash { uint32_t operator()(const T &value) const @@ -165,7 +165,7 @@ inline uint32_t hash_string(StringRef str) template<> struct DefaultHash<std::string> { /** - * Take a StringRef as parameter to support heterogeneous lookups in hash table implementations + * Take a #StringRef as parameter to support heterogeneous lookups in hash table implementations * when std::string is used as key. */ uint32_t operator()(StringRef value) const |