fork download
  1. #include <iterator>
  2. #include <iostream>
  3.  
  4. void vector_ctor(size_t n, int element)
  5. {
  6. std::cout << "constructing from size\n";
  7. }
  8.  
  9. template <class I,
  10. typename std::enable_if<not std::is_convertible<I, int>::value, int>::type = 0>
  11. void vector_ctor(I begin, I end)
  12. {
  13. std::cout << "iterators indeed!\n";
  14. }
  15.  
  16. int main()
  17. {
  18. vector_ctor(static_cast<size_t>(1), 1);
  19. std::cout << '\n';
  20.  
  21. vector_ctor(1, 1);
  22. std::cout << '\n';
  23.  
  24. int d;
  25. vector_ctor(&d, &d);
  26. std::cout << '\n';
  27. }
Success #stdin #stdout 0s 2928KB
stdin
Standard input is empty
stdout
constructing from size

constructing from size

iterators indeed!