Advertisement
Guest User

Untitled

a guest
Nov 17th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.92 KB | None | 0 0
  1. struct Vec3f {                                                                  
  2.   Vec3f() : Vec3f(0, 0, 0) {}                                                  
  3.   Vec3f(float x, float y, float z) : x(x), y(y), z(z) {}                        
  4.   Vec3f& operator=(const Vec3f& v) = default;                                  
  5.   Vec3f& operator=(Vec3f&& v) = delete;                                        
  6.   Vec3f(const Vec3f& v) = default;                                              
  7.   Vec3f(Vec3f&& v) = delete;                                                    
  8.   ~Vec3f() = default;                                                          
  9.                                                                                
  10.   float x, y, z;                                                                
  11. };                                                                              
  12.                                                                                
  13. Vec3f sum(const Vec3f& a, const Vec3f& b) {                                    
  14.   Vec3f out(0, 0, 0);                                                          
  15.   out.x = a.x + b.x;                                                            
  16.   out.y = a.y + b.y;                                                            
  17.   out.z = a.z + b.z;                                                            
  18.   return out;                                                                  
  19. }                                                                              
  20.                                                                                
  21. int main(int argc, char **argv) {                                              
  22.   Vec3f a(1, 2, 3), b(4, 5, 6);                                                
  23.   Vec3f c = sum(a, b);                                                          
  24.   return c.x > 1;                                                              
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement