Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-89212

variadic templates

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.14.0 RC2
    • Core: Object Model
    • None
    • Qt Creator 4.9.1
      Based on Qt 5.12.3 (MSVC 2017, 32 bit)

      Built on May 26 2019 21:17:08

      From revision 168e91b618
    • Windows

      #include <QCoreApplication>
      #include <stdio.h>
      #include<iostream>
      
      template<typename T,typename o > void swap(T &a,T& b)
      {  T temp= a; a=b; b=temp;    }
      
      int main(int argc, char *argv[])
      {
          QCoreApplication a(argc, argv);  
          int aa=10; 
          int bb=20;  
          swap<int,int> (aa,bb);    
          std::cout<<aa<<std::endl; 
          std::cout<<bb<<std::endl;  
      
          return a.exec(); 
      }
      

       

      ======================

       

      this only use by qt  ???

       

      othes:

       
       

      #include <iostream>
      
      template<typename T>void swap(T &a, T &b) 
      {  T temp= a; a=b; b=temp;    }
      
      int main()
      {
          int a = 2, b = 3;
      
          swap(a, b);
      
           std::cout << "a=" << a << ", b=" << b << std::endl;
      }
      

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            thiago Thiago Macieira
            274337614 yi xu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes