#include <iostream>
#include <type_traits>
using namespace std;
template<typename T>
constexpr auto is_pure_input_iterator(int) ->
conditional_t
<
is_convertible_v
<
iterator_traits<T>::iterator_category,
input_iterator_tag
>,
true_type, true_type
>;
template<typename>
constexpr false_type is_pure_input_iterator(...);
int main()
{
cout << boolalpha
<< decltype(is_pure_input_iterator<istream_iterator<int>>(0))::value
<< endl;
return {};
}
The expected output should be: true
, but the actual one is false
.
What's wrong in my code?
Aucun commentaire:
Enregistrer un commentaire