Compare commits

...

10 Commits

Author SHA1 Message Date
Peter Dimov
1dd2f73866 Disable is_range_test2 for gcc-4.7 2024-03-05 19:20:47 +02:00
Peter Dimov
1278f1c2b5 Update .drone.jsonnet 2024-03-05 19:11:58 +02:00
Peter Dimov
067f636d6c Disable hash_fs_path_test for gcc-4.7 2024-03-05 19:09:43 +02:00
Peter Dimov
338c053889 Fix hash_is_avalanching_test2 for libc++ 16 and later 2024-03-05 19:07:24 +02:00
Peter Dimov
94d4f7cb88 Avoid -Wsign-conversion under GCC 6/7 2024-03-05 18:43:35 +02:00
Peter Dimov
6957a20ab1 Avoid compilation errors caused by iterator_traits<void*>. Refs #36. 2024-03-05 18:19:19 +02:00
Peter Dimov
28cc18a4bc Add test with types that return void* from begin/end. Refs #36. 2024-03-05 17:44:03 +02:00
Peter Dimov
7288df8bee Fix is_tuple_like for cv-qualified types under old compilers 2023-12-08 02:00:22 +02:00
Peter Dimov
5c2d5e5b36 Test is_tuple_like with const-qualified types 2023-12-07 22:32:10 +02:00
Peter Dimov
db8743e1c3 Update ci.yml 2023-12-07 22:21:26 +02:00
9 changed files with 120 additions and 10 deletions

View File

@@ -333,6 +333,13 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
"clang-16",
),
linux_pipeline(
"Linux 23.10 Clang 17",
"cppalliance/droneubuntu2310:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-17', CXXSTD: '11,14,17,20,2b' },
"clang-17",
),
macos_pipeline(
"MacOS 10.15 Xcode 12.2 UBSAN",
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '11,14,17,2a' } + ubsan,
@@ -358,7 +365,7 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
windows_pipeline(
"Windows VS2015 msvc-14.0",
"cppalliance/dronevs2015",
{ TOOLSET: 'msvc-14.0', CXXSTD: '14,latest' },
{ TOOLSET: 'msvc-14.0', CXXSTD: '14,latest', B2_DONT_EMBED_MANIFEST: '1' },
),
windows_pipeline(

View File

@@ -124,24 +124,33 @@ jobs:
- toolset: clang
compiler: clang++-13
cxxstd: "11,14,17,20,2b"
os: ubuntu-22.04
container: ubuntu:22.04
os: ubuntu-latest
install: clang-13
- toolset: clang
compiler: clang++-14
cxxstd: "11,14,17,20,2b"
os: ubuntu-22.04
container: ubuntu:22.04
os: ubuntu-latest
install: clang-14
- toolset: clang
compiler: clang++-15
cxxstd: "11,14,17,20,2b"
os: ubuntu-22.04
container: ubuntu:22.04
os: ubuntu-latest
install: clang-15
- toolset: clang
compiler: clang++-16
cxxstd: "11,14,17,20,2b"
os: ubuntu-latest
container: ubuntu:23.04
os: ubuntu-latest
install: clang-16
- toolset: clang
compiler: clang++-17
cxxstd: "11,14,17,20,2b"
container: ubuntu:23.10
os: ubuntu-latest
install: clang-17
- toolset: clang
cxxstd: "11,14,17,2a"
os: macos-11

View File

@@ -14,8 +14,12 @@ namespace boost
namespace hash_detail
{
template<class T> struct iterator_traits: std::iterator_traits<T> {};
template<> struct iterator_traits< void* > {};
template<> struct iterator_traits< void const* > {};
template<class T, class It>
std::integral_constant< bool, !std::is_same<typename std::remove_cv<T>::type, typename std::iterator_traits<It>::value_type>::value >
std::integral_constant< bool, !std::is_same<typename std::remove_cv<T>::type, typename iterator_traits<It>::value_type>::value >
is_range_check( It first, It last );
template<class T> decltype( is_range_check<T>( std::declval<T const&>().begin(), std::declval<T const&>().end() ) ) is_range_( int );

View File

@@ -26,7 +26,7 @@ template<class T> struct is_tuple_like_<T, std::integral_constant<bool, std::tup
namespace container_hash
{
template<class T> struct is_tuple_like: hash_detail::is_tuple_like_<T>
template<class T> struct is_tuple_like: hash_detail::is_tuple_like_< typename std::remove_cv<T>::type >
{
};

View File

@@ -75,10 +75,10 @@ run hash_integral_test.cpp ;
run hash_string_test2.cpp ;
# for gcc-4.8
local fs-path-req = "-<toolset>gcc:<cxxflags>-Wshadow" "-<toolset>gcc:<cxxflags>-Wconversion" ;
local fs-path-req = "-<toolset>gcc:<cxxflags>-Wshadow" "-<toolset>gcc:<cxxflags>-Wconversion" <toolset>gcc-4.7:<build>no ;
run hash_fs_path_test.cpp /boost//filesystem/<warnings>off : : : $(fs-path-req) <toolset>msvc-14.0,<cxxstd>latest:<build>no <toolset>msvc-8.0:<build>no <undefined-sanitizer>norecover:<link>static ;
run is_range_test2.cpp : : : $(fs-path-req) <toolset>msvc-8.0:<build>no ;
run hash_fs_path_test.cpp /boost//filesystem/<warnings>off : : : $(fs-path-req) <toolset>msvc-14.0,<cxxstd>latest:<build>no <undefined-sanitizer>norecover:<link>static ;
run is_range_test2.cpp : : : $(fs-path-req) ;
run hash_container_test.cpp ;
@@ -125,3 +125,6 @@ run is_tuple_like_test.cpp ;
run hash_tuple_like_test.cpp ;
run hash_tuple_like_test2.cpp
: : : <warnings>extra ;
run is_range_test4.cpp ;
run hash_container_test2.cpp ;

View File

@@ -0,0 +1,39 @@
// Copyright 2024 Peter Dimov.
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/container_hash/hash.hpp>
#include <boost/core/lightweight_test.hpp>
struct X1
{
void* begin() const { return nullptr; }
void* end() const { return nullptr; }
};
std::size_t hash_value( X1 const& )
{
return 1;
}
struct X2
{
void const* begin() const { return nullptr; }
void const* end() const { return nullptr; }
};
std::size_t hash_value( X2 const& )
{
return 2;
}
int main()
{
X1 x1;
BOOST_TEST_EQ( boost::hash<X1>()( x1 ), 1u );
X2 x2;
BOOST_TEST_EQ( boost::hash<X2>()( x2 ), 2u );
return boost::report_errors();
}

View File

@@ -44,7 +44,11 @@ int main()
#endif
#if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 160000
// std::char_traits<Ch> is deprecated for non-char types
#else
BOOST_TEST_TRAIT_FALSE(( hash_is_avalanching< boost::hash<std::basic_string_view<my_char> > > ));
#endif
return boost::report_errors();
}

28
test/is_range_test4.cpp Normal file
View File

@@ -0,0 +1,28 @@
// Copyright 2024 Peter Dimov.
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/container_hash/is_range.hpp>
#include <boost/core/lightweight_test_trait.hpp>
struct X1
{
void* begin() const;
void* end() const;
};
struct X2
{
void const* begin() const;
void const* end() const;
};
int main()
{
using boost::container_hash::is_range;
BOOST_TEST_TRAIT_FALSE((is_range<X1>));
BOOST_TEST_TRAIT_FALSE((is_range<X2>));
return boost::report_errors();
}

View File

@@ -70,20 +70,36 @@ int main()
using boost::container_hash::is_tuple_like;
BOOST_TEST_TRAIT_FALSE((is_tuple_like<void>));
BOOST_TEST_TRAIT_FALSE((is_tuple_like<void const>));
BOOST_TEST_TRAIT_FALSE((is_tuple_like<int>));
BOOST_TEST_TRAIT_FALSE((is_tuple_like<int const>));
BOOST_TEST_TRAIT_FALSE((is_tuple_like<X>));
BOOST_TEST_TRAIT_FALSE((is_tuple_like<X const>));
BOOST_TEST_TRAIT_FALSE((is_tuple_like<int[2]>));
BOOST_TEST_TRAIT_FALSE((is_tuple_like<int const [2]>));
#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !BOOST_WORKAROUND(BOOST_MSVC, <= 1800)
BOOST_TEST_TRAIT_TRUE((is_tuple_like< std::pair<int, X> >));
BOOST_TEST_TRAIT_TRUE((is_tuple_like< std::pair<int, X> const>));
BOOST_TEST_TRAIT_TRUE((is_tuple_like< std::tuple<> >));
BOOST_TEST_TRAIT_TRUE((is_tuple_like< std::tuple<> const>));
BOOST_TEST_TRAIT_TRUE((is_tuple_like< std::tuple<X> >));
BOOST_TEST_TRAIT_TRUE((is_tuple_like< std::tuple<X> const>));
BOOST_TEST_TRAIT_TRUE((is_tuple_like< std::tuple<X, X> >));
BOOST_TEST_TRAIT_TRUE((is_tuple_like< std::tuple<X, X> const>));
BOOST_TEST_TRAIT_TRUE((is_tuple_like< std::tuple<X, X, X> >));
BOOST_TEST_TRAIT_TRUE((is_tuple_like< std::tuple<X, X, X> const>));
BOOST_TEST_TRAIT_TRUE((is_tuple_like<user::Y>));
BOOST_TEST_TRAIT_TRUE((is_tuple_like<user::Y const>));
#endif