Skip to content

Commit

Permalink
Merge pull request #27 from Lastique/patch-1
Browse files Browse the repository at this point in the history
Fix typos in the docs
  • Loading branch information
pdimov authored Dec 9, 2024
2 parents 26b1602 + e1ac6ab commit ecc605c
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions doc/hash2/hashing_objects.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ int main()
unsigned char v2[] = { 0x04, 0x03, 0x02, 0x01 };
h2.update( v2, sizeof(v2) );

assert( h1.result() == h2.result();
assert( h1.result() == h2.result() );
}
```

Expand All @@ -160,7 +160,7 @@ int main()
std::uint32_t v2 = 0x4048f5c3;
boost::hash2::hash_append( h2, {}, v2 );

assert( h1.result() == h2.result();
assert( h1.result() == h2.result() );
}
```

Expand All @@ -177,7 +177,7 @@ int main()
boost::hash2::fnv1a_32 h2;
boost::hash2::hash_append( h2, {}, -0.0 );

assert( h1.result() == h2.result();
assert( h1.result() == h2.result() );
}
```

Expand All @@ -200,7 +200,7 @@ int main()
int v2 = 123;
boost::hash2::hash_append( h2, {}, v2 );

assert( h1.result() == h2.result();
assert( h1.result() == h2.result() );
}
```

Expand All @@ -219,7 +219,7 @@ int main()
boost::hash2::fnv1a_32 h2;
boost::hash2::hash_append( h2, {}, reinterpret_cast<std::uintptr_t>(&x1) );

assert( h1.result() == h2.result();
assert( h1.result() == h2.result() );
}
```

Expand All @@ -239,15 +239,15 @@ int main()
boost::hash2::fnv1a_32 h2;
boost::hash2::hash_append_range( h2, {}, v1 + 0, v1 + 4 );

assert( h1.result() == h2.result();
assert( h1.result() == h2.result() );

boost::hash2::fnv1a_32 h3;
boost::hash2::hash_append( h3, {}, v1[0] );
boost::hash2::hash_append( h3, {}, v1[1] );
boost::hash2::hash_append( h3, {}, v1[2] );
boost::hash2::hash_append( h3, {}, v1[3] );

assert( h1.result() == h3.result();
assert( h1.result() == h3.result() );
}
```

Expand All @@ -257,7 +257,7 @@ When `T` is a _range_ (`boost::container_hash::is_range<T>::value` is `true`), i

* When `T` is an _unordered range_ (`boost::container_hash::is_unordered_range<T>::value` is `true`), `hash_append` invokes `hash_append_unordered_range(h, f, v.begin(), v.end())`.
`hash_append_unordered_range` derives a hash value from the range elements in such a way so that their order doesn't affect the hash value.
* When `T` is a _contiguous range_ (`boost::container_hash::is_contiguous_range<T>::valie` is `true`), `hash_append` first invokes `hash_append_range(h, f, v.data(), v.data() + v.size())`,
* When `T` is a _contiguous range_ (`boost::container_hash::is_contiguous_range<T>::value` is `true`), `hash_append` first invokes `hash_append_range(h, f, v.data(), v.data() + v.size())`,
then, if `has_constant_size<T>::value` is `false`, it invokes `hash_append_size(h, f, v.size())`.
* Otherwise, `hash_append` first invokes `hash_append_range(h, f, v.begin(), v.end())`,
then, if `has_constant_size<T>::value` is `false`, it invokes `hash_append_size(h, f, m)`, where `m` is `std::distance(v.begin(), v.end())`.
Expand All @@ -275,19 +275,19 @@ int main()
std::list<int> v2 = { 1, 2, 3, 4 };
boost::hash2::hash_append( h2, {}, v2 );

assert( h1.result() == h2.result();
assert( h1.result() == h2.result() );

boost::hash2::fnv1a_32 h3;
boost::hash2::hash_append_range( h3, {}, v1.data(), v1.data() + v1.size() );
boost::hash2::hash_append_size( h3, {}, v1.size() );

assert( h1.result() == h3.result();
assert( h1.result() == h3.result() );

boost::hash2::fnv1a_32 h4;
boost::hash2::hash_append_range( h4, {}, v2.begin(), v2.end() );
boost::hash2::hash_append_size( h4, {}, std::distance(v2.begin(), v2.end()) );

assert( h2.result() == h4.result();
assert( h2.result() == h4.result() );
}
```

Expand All @@ -309,7 +309,7 @@ int main()
boost::hash2::hash_append( h2, {}, get<1>(v1) );
boost::hash2::hash_append( h2, {}, get<2>(v1) );

assert( h1.result() == h2.result();
assert( h1.result() == h2.result() );
}
```

Expand Down Expand Up @@ -343,7 +343,7 @@ int main()
boost::hash2::hash_append( h2, {}, v1.a );
boost::hash2::hash_append( h2, {}, v1.b );

assert( h1.result() == h2.result();
assert( h1.result() == h2.result() );
}
```

Expand Down Expand Up @@ -409,7 +409,7 @@ class Str
{
private:

static constexpr N = 32;
static constexpr unsigned int N = 32;

std::uint8_t size_ = 0;
char data_[ N ] = {};
Expand Down

0 comments on commit ecc605c

Please sign in to comment.