Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • +1 for catching that you need to return a new Vector2f instance, not a reference to the current object. Commented Jan 28, 2010 at 14:53
  • 1
    This is the implementation of a binary operator-. Unary has no parameter as @anon said. Commented Jan 27, 2011 at 16:12
  • 9
    Nope, it is an unary operator. It takes a Vector2f as parameter since it is defined in namespace- rather than class scope. My response is correct. Commented Jan 27, 2011 at 18:25
  • 11
    See also 13.5.1 - 'A prefix unary operator shall be implemented by a non-static member function (9.3) with no parameters or a non-member function with one parameter'. Commented Jan 27, 2011 at 18:29
  • 2
    @shunz it's an unary operator. note it is namespace scope not class scope. Commented Feb 9, 2012 at 21:08