// // Copyright (c) 2018 James E. King III // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // // std::hash support for uuid // #include #include #include #include #include #include #if !defined(BOOST_NO_CXX11_HDR_UNORDERED_SET) && !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) #include #endif int main(int, char*[]) { #if !defined(BOOST_NO_CXX11_HDR_UNORDERED_SET) && !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) using namespace boost::uuids; string_generator gen; uuid u1 = gen("01234567-89AB-CDEF-0123-456789abcdef"); uuid u2 = gen("fedcba98-7654-3210-fedc-ba9876543210"); std::hash hasher; BOOST_TEST(hasher(u1) != hasher(u2)); std::unordered_set uns; uns.insert(u1); uns.insert(u2); BOOST_TEST_EQ(uns.size(), 2); return boost::report_errors(); #else std::cout << "test skipped - no library support for std::hash or std::unordered_set" << std::endl; return 0; #endif }