Advertisement

元编程:is_rvalue_reference(例如:Python版本)

阅读量:

判定某一引用是否属于右值引用

复制代码
 #include <iostream>

    
 #include <type_traits>
    
  
    
 int main()
    
 {
    
     int a = 10;
    
     int& b = a;
    
  
    
     std::cout << "This Demo: is_rvalue_reference" << std::endl;
    
     if(std::is_rvalue_reference<int>::value)
    
     {
    
     std::cout << __LINE__ << ": is right value reference" << std::endl;
    
     }
    
     else
    
     {
    
     std::cout << __LINE__ << ": isn't right value reference " << std::endl;
    
     }
    
  
    
     if(std::is_rvalue_reference<int&>::value)
    
     {
    
     std::cout << __LIN

全部评论 (0)

还没有任何评论哟~