commit d58dfd4b9f2333933c1efb606599039768b3e72c parent b4bb97fb0b82f0e90a1ec109a45b547c56246790 Author: Michael Savage <mikejsavage@gmail.com> Date: Sun Jul 2 12:12:46 +0300 str ==/!= const char * Diffstat:
str.h | | | 9 | +++++++++ |
diff --git a/str.h b/str.h @@ -2,6 +2,7 @@ #include <stdio.h> #include <stdlib.h> +#include <string.h> #include "intrinsics.h" #include "strlcpy.h" @@ -69,6 +70,14 @@ public: return length; } + bool operator==( const char * rhs ) const { + return strcmp( buf, rhs ) == 0; + } + + bool operator!=( const char * rhs ) const { + return !( *this == rhs ); + } + private: char buf[ N ]; size_t length;