(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.
Post Reply
Mikenoworth
Posts: 78
Joined: Sat May 27, 2006 9:24 pm
Location: Logan, UT

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

Post by Mikenoworth »

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
Post Reply