fork(1) download
  1. #include <iostream>
  2. #include <vector>
  3. #include <iterator>
  4. #include <type_traits>
  5.  
  6. template<typename... Args>
  7. using void_t = void;
  8.  
  9. template<typename T, typename = void>
  10. struct is_iterator : std::false_type {
  11.  
  12. };
  13.  
  14. template<typename T>
  15. struct is_iterator<T, void_t<typename std::iterator_traits<T>::value_type>> : std::true_type {
  16.  
  17. };
  18.  
  19. int main() {
  20. std::cout << is_iterator<int*>::value << is_iterator<std::back_insert_iterator<std::vector<int>>>::value;
  21. }
Success #stdin #stdout 0s 3096KB
stdin
Standard input is empty
stdout
11