Protect against overloaded comma operators in decltype

This commit is contained in:
morinmorin
2019-02-04 02:19:08 +09:00
committed by Victor Zverovich
parent 467520e7a4
commit 430e6ac9b6
3 changed files with 12 additions and 9 deletions
+3 -2
View File
@@ -76,7 +76,7 @@ template <typename OutputIterator> void copy(char ch, OutputIterator out) {
template <typename T> class is_like_std_string {
template <typename U>
static auto check(U* p)
-> decltype(p->find('a'), p->length(), p->data(), int());
-> decltype((void)p->find('a'), p->length(), (void)p->data(), int());
template <typename> static void check(...);
public:
@@ -106,7 +106,8 @@ template <typename T> class is_tuple_like_ {
template <typename U>
static auto check(U* p)
-> decltype(std::tuple_size<U>::value,
internal::declval<typename std::tuple_element<0, U>::type>(),
(void)internal::declval<
typename std::tuple_element<0, U>::type>(),
int());
template <typename> static void check(...);