books.hpp 679 B

1234567891011121314151617181920212223242526
  1. // Copyright 2005-2009 Daniel James.
  2. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  3. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  4. // This example illustrates how to use boost::hash with a custom hash function.
  5. // The implementation is contained in books.cpp
  6. #include <cstddef>
  7. #include <string>
  8. namespace library
  9. {
  10. struct book
  11. {
  12. int id;
  13. std::string author;
  14. std::string title;
  15. book(int i, std::string const& a, std::string const& t)
  16. : id(i), author(a), title(t) {}
  17. };
  18. bool operator==(book const&, book const&);
  19. std::size_t hash_value(book const&);
  20. }