almo2001

Compile error

Dec 12th, 2013
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1.     class Spacer : public ElementEx
  2.     {
  3.     public:
  4.         Spacer(Vector2& size)
  5.         : ElementEx(ElementProperties(AnchoredPosition(), size), TouchBehaviour::PassThrough)
  6.         {
  7.         }
  8.     };
  9.  
  10.     // Does not work
  11.     rowContainer->Register(new Spacer(Vector2(maxWidth, height)));
  12.  
  13.     // Works
  14.     Vector2 spacerSize(maxWidth, height);
  15.     rowContainer->Register(new Spacer(spacerSize));
  16.  
  17. /*
  18. the "does not work line" generates these errors:
  19.  
  20. Candidate constructor (the implicit copy constructor) not viable: no known conversion from 'Vector2' to 'const <anonymous>::Spacer' for 1st argument
  21.  
  22. Candidate constructor not viable: expects an l-value for 1st argument
  23. */
Advertisement
Add Comment
Please, Sign In to add comment