Skip to content

Commit 8b98081

Browse files
committed
Fixed the problem
1 parent 77ade12 commit 8b98081

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

include/boost/redis/adapter/detail/adapters.hpp

+12-6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include <set>
1818
#include <optional>
19+
#include <type_traits>
1920
#include <unordered_set>
2021
#include <forward_list>
2122
#include <system_error>
@@ -37,13 +38,18 @@
3738
namespace boost::redis::adapter::detail
3839
{
3940

40-
template <class> struct is_integral : std::false_type {};
41-
42-
template <> struct is_integral<long long int > : std::true_type {};
43-
template <> struct is_integral<unsigned long long int> : std::true_type {};
44-
template <> struct is_integral<int > : std::true_type {};
41+
// Exclude bools, char and charXY_t types
42+
template <class T> struct is_integral_number : std::is_integral<T> {};
43+
template <> struct is_integral_number<bool> : std::false_type {};
44+
template <> struct is_integral_number<char> : std::false_type {};
45+
template <> struct is_integral_number<char16_t> : std::false_type {};
46+
template <> struct is_integral_number<char32_t> : std::false_type {};
47+
template <> struct is_integral_number<wchar_t> : std::false_type {};
48+
#ifdef __cpp_char8_t
49+
template <> struct is_integral_number<char8_t> : std::false_type {};
50+
#endif
4551

46-
template<class T, bool = is_integral<T>::value>
52+
template<class T, bool = is_integral_number<T>::value>
4753
struct converter;
4854

4955
template<class T>

test/test_conversions.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ BOOST_AUTO_TEST_CASE(ints)
3636
ignore_t,
3737
signed char,
3838
unsigned char,
39-
char,
4039
short,
4140
unsigned short,
4241
int,
@@ -66,5 +65,4 @@ BOOST_AUTO_TEST_CASE(ints)
6665
BOOST_TEST(std::get<8>(resp).value() == 42);
6766
BOOST_TEST(std::get<9>(resp).value() == 42);
6867
BOOST_TEST(std::get<10>(resp).value() == 42);
69-
BOOST_TEST(std::get<11>(resp).value() == 42);
7068
}

0 commit comments

Comments
 (0)