| Line | |
|---|
| 1 | |
|---|
| 2 | // Copyright Daniel James 2005. Use, modification, and distribution are |
|---|
| 3 | // subject to the Boost Software License, Version 1.0. (See accompanying |
|---|
| 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
|---|
| 5 | |
|---|
| 6 | // This example illustrates how to use boost::hash with a custom hash function. |
|---|
| 7 | // The implementation is contained in books.cpp |
|---|
| 8 | |
|---|
| 9 | #include <cstddef> |
|---|
| 10 | #include <string> |
|---|
| 11 | |
|---|
| 12 | namespace library |
|---|
| 13 | { |
|---|
| 14 | struct book |
|---|
| 15 | { |
|---|
| 16 | int id; |
|---|
| 17 | std::string author; |
|---|
| 18 | std::string title; |
|---|
| 19 | |
|---|
| 20 | book(int i, std::string const& a, std::string const& t) |
|---|
| 21 | : id(i), author(a), title(t) {} |
|---|
| 22 | }; |
|---|
| 23 | |
|---|
| 24 | bool operator==(book const&, book const&); |
|---|
| 25 | std::size_t hash_value(book const&); |
|---|
| 26 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.