Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/boost/pfr/detail/detectors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace boost { namespace pfr { namespace detail {

template <class S> auto hash_detector_msvc_helper(long) -> decltype(std::hash<S>{}(std::declval<S>()));
template <class S> can_not_apply hash_detector_msvc_helper(int);
template <class T1, class T2> using hash_detector = decltype(hash_detector_msvc_helper<T1,T2>(1L));
template <class T1, class> using hash_detector = decltype(hash_detector_msvc_helper<T1>(1L));


template <class S, class T> auto ostreamable_detector_msvc_helper(long) -> decltype(std::declval<S>() << std::declval<T>());
Expand Down
1 change: 1 addition & 0 deletions test/core/run/functions_for.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ void test_some_comparable_struct() {
ss >> s4;
std::cout << s4 << std::endl;
BOOST_TEST_EQ(s1, s4);
BOOST_TEST_EQ(hash_value(s1), hash_value(s4));
int i = 1, j = 2;
BOOST_TEST_NE(i, j);
}
Expand Down
9 changes: 9 additions & 0 deletions test/core/run/ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ void test_comparable_struct() {

void test_empty_struct() {
struct empty {};
BOOST_TEST_EQ(boost::pfr::hash_value(empty{}), boost::pfr::hash_value(empty{}));
std::cout << boost::pfr::io(empty{});
BOOST_TEST(boost::pfr::eq(empty{}, empty{}));
}
Expand All @@ -85,11 +86,19 @@ struct comparable_struct {

int main() {
test_comparable_struct<foo::comparable_struct>();
BOOST_TEST_EQ(
boost::pfr::hash_value(foo::comparable_struct{}),
boost::pfr::hash_value(foo::comparable_struct{})
);

struct local_comparable_struct {
int i; short s; bool bl; int a,b,c,d,e,f;
};
test_comparable_struct<local_comparable_struct>();
BOOST_TEST_EQ(
boost::pfr::hash_value(local_comparable_struct{}),
boost::pfr::hash_value(local_comparable_struct{})
);

struct local_comparable_struct_with_union {
int i; short s; bool bl; int a,b,c,d,e; test_union u;
Expand Down
Loading