mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-04 14:04:32 +00:00 
			
		
		
		
	Move constructor
This commit is contained in:
		@@ -257,7 +257,11 @@ public:
 | 
				
			|||||||
    }  	
 | 
					    }  	
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  
 | 
					  Lattice(Lattice&& r){ // move constructor
 | 
				
			||||||
 | 
					    _grid = r._grid;
 | 
				
			||||||
 | 
					    checkerboard = r.checkerboard;
 | 
				
			||||||
 | 
					    _odata=std::move(r._odata);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  virtual ~Lattice(void) = default;
 | 
					  virtual ~Lattice(void) = default;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
@@ -287,6 +291,24 @@ public:
 | 
				
			|||||||
    return *this;
 | 
					    return *this;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  strong_inline Lattice<vobj> & operator = (const Lattice<vobj> & r){
 | 
				
			||||||
 | 
					    _grid        = r._grid;
 | 
				
			||||||
 | 
					    checkerboard = r.checkerboard;
 | 
				
			||||||
 | 
					    _odata.resize(_grid->oSites());// essential
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    parallel_for(int ss=0;ss<_grid->oSites();ss++){
 | 
				
			||||||
 | 
					      _odata[ss]=r._odata[ss];
 | 
				
			||||||
 | 
					    }  	
 | 
				
			||||||
 | 
					    return *this;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  strong_inline Lattice<vobj> & operator = (Lattice<vobj> && r)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    _grid        = r._grid;
 | 
				
			||||||
 | 
					    checkerboard = r.checkerboard;
 | 
				
			||||||
 | 
					    _odata       =std::move(r._odata);
 | 
				
			||||||
 | 
					    return *this;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  // *=,+=,-= operators inherit behvour from correspond */+/- operation
 | 
					  // *=,+=,-= operators inherit behvour from correspond */+/- operation
 | 
				
			||||||
  template<class T> strong_inline Lattice<vobj> &operator *=(const T &r) {
 | 
					  template<class T> strong_inline Lattice<vobj> &operator *=(const T &r) {
 | 
				
			||||||
    *this = (*this)*r;
 | 
					    *this = (*this)*r;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user