SDLPP: add != for vector, add << for vector
This commit is contained in:
parent
b87318f44d
commit
4728056b76
@ -2,6 +2,7 @@
|
||||
#define SDLPP_HPP_VECTOR
|
||||
|
||||
#include "sdlpp_common.hpp"
|
||||
#include <ostream>
|
||||
|
||||
namespace SDLPP {
|
||||
template < typename T > class SDLPPSCOPE Vec2D {
|
||||
@ -41,6 +42,12 @@ public:
|
||||
bool operator==( const Vec2D &other ) {
|
||||
return other._x == _x && other._y == _y;
|
||||
}
|
||||
bool operator!=( const Vec2D &other ) {
|
||||
return !( *this == other );
|
||||
}
|
||||
template < typename K >
|
||||
friend std::ostream &operator<<( std::ostream &stream,
|
||||
const Vec2D< K > &vec );
|
||||
|
||||
private:
|
||||
T _x = 0.0;
|
||||
@ -54,6 +61,11 @@ template < typename T >
|
||||
Vec2D< T > operator/( double divisor, const Vec2D< T > &vec ) {
|
||||
return vec / divisor;
|
||||
}
|
||||
template < typename T >
|
||||
std::ostream &operator<<( std::ostream &stream, const Vec2D< T > &vec ) {
|
||||
stream << '(' << vec._x << ", " << vec._y << ")";
|
||||
return stream;
|
||||
}
|
||||
} // namespace SDLPP
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user