fork download
  1. #include <iostream>
  2. #include <utility>
  3. #include <string>
  4.  
  5. void f(void const* v, std::false_type){
  6. std::cout << "f(void*)\n";
  7. }
  8. void f(std::string const& s, std::true_type){
  9. std::cout << "f(const std::string &)\n";
  10. }
  11. template<typename T>
  12. void f(T&&t){
  13. return f(std::forward<T>(t), std::is_convertible<T,std::string>() );
  14. }
  15.  
  16. int main() {
  17. f("hello");
  18. // your code goes here
  19. return 0;
  20. }
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
f(const std::string &)