(C++) SColorf comparison operators !=, == updated

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.

(C++) SColorf comparison operators !=, == updated

Postby Mikenoworth » Sun Jul 09, 2006 11:55 pm

SColor.h should have these comparison operators in the SColorf class, as they are already in the sColor class. Why leave them out?

Code: Select all
      //! Compares the color to another color.
      //! \return Returns true if the colors are the same, and false if not.
      inline bool operator==(const SColorf& other) const { return ( other.r==r&&other.g==g&&other.b==b&&other.a==a ); }

      //! Compares the color to another color.
      //! \return Returns true if the colors are different, and false if they are the same.
      inline bool operator!=(const SColorf& other) const { return ( other.r!=r&&other.g!=g&&other.b!=b&&other.a!=a ); }
Stout Beer
Mikenoworth
 
Posts: 78
Joined: Sat May 27, 2006 9:24 pm
Location: Logan, UT

Return to Code Snippets

Who is online

Users browsing this forum: No registered users and 0 guests