# Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world.

### libs/container_hash/examples/point.cpp

```

// Force use of assert.
#if defined(NDEBUG)
#undef NDEBUG
#endif

#include <boost/container_hash/hash.hpp>
#include <cassert>

// This example illustrates how to use boost::hash_combine to generate a hash
// value from the different members of a class. For full details see the hash
// tutorial.

class point
{
int x;
int y;
public:
point() : x(0), y(0) {}
point(int x, int y) : x(x), y(y) {}

bool operator==(point const& other) const
{
return x == other.x && y == other.y;
}

friend std::size_t hash_value(point const& p)
{
std::size_t seed = 0;
boost::hash_combine(seed, p.x);
boost::hash_combine(seed, p.y);

return seed;
}
};

int main()
{
boost::hash<point> point_hasher;

point p1(0, 0);
point p2(1, 2);
point p3(4, 1);
point p4 = p1;

assert(point_hasher(p1) == point_hasher(p4));

// These tests could legally fail, but if they did it'd be a pretty bad
// hash function.
assert(point_hasher(p1) != point_hasher(p2));
assert(point_hasher(p1) != point_hasher(p3));

return 0;
}

```
{"ft_lang_label":"__label__en","ft_lang_prob":0.53759706,"math_prob":0.9864408,"size":1197,"snap":"2020-45-2020-50","text_gpt3_token_len":345,"char_repetition_ratio":0.14082146,"word_repetition_ratio":0.0,"special_character_ratio":0.33082706,"punctuation_ratio":0.24899599,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9916906,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-11-30T05:43:55Z\",\"WARC-Record-ID\":\"<urn:uuid:cc6f9ff5-9106-45de-8232-ec31e13ed599>\",\"Content-Length\":\"4614\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:8c413459-13a0-46f0-b6b9-75ea06971a2c>\",\"WARC-Concurrent-To\":\"<urn:uuid:43b1c2d1-6046-4797-855c-cc28c390edab>\",\"WARC-IP-Address\":\"146.20.110.251\",\"WARC-Target-URI\":\"https://www.boost.org/doc/libs/1_74_0/libs/container_hash/examples/point.cpp\",\"WARC-Payload-Digest\":\"sha1:MDOXWXKW56LMC2BRUUXN7K46463LO6DJ\",\"WARC-Block-Digest\":\"sha1:UYVHG7KQ5AMTDBZRSA3BWH2CG2OHTK56\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-50/CC-MAIN-2020-50_segments_1606141205147.57_warc_CC-MAIN-20201130035203-20201130065203-00647.warc.gz\"}"}