// Copyright 2022 Peter Dimov. // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt #include #include #include #include #include #include #if !defined(BOOST_NO_CXX11_HDR_FORWARD_LIST) # include #endif template std::size_t hv( T const& t ) { return boost::hash()( t ); } template void test() { for( std::size_t i = 0; i < 8; ++i ) { std::vector v( i ); std::size_t h0 = hv( v ); std::deque d( v.begin(), v.end() ); BOOST_TEST_EQ( h0, hv( d ) ); std::list l( v.begin(), v.end() ); BOOST_TEST_EQ( h0, hv( l ) ); #if !defined(BOOST_NO_CXX11_HDR_FORWARD_LIST) std::forward_list f( v.begin(), v.end() ); BOOST_TEST_EQ( h0, hv( f ) ); #endif } } int main() { test(); test(); test(); test(); test(); test(); #if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L test(); #endif #if defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603L test(); #endif return boost::report_errors(); }