ChessPlusPlus
WIP
cplusplus.com Community Project
|
#include <Position.hpp>
Public Types | |
using | value_type = T |
Public Member Functions | |
Position (T x_=T(), T y_=T()) noexcept | |
Position (Position const &)=default | |
Position (Position &&)=default | |
Position & | operator= (Position const &)=default |
Position & | operator= (Position &&)=default |
~Position ()=default | |
bool | isWithin (Position const &topleft, Position const &bottomright) const noexcept |
Position & | move (typename MakeSigned< T >::type xoff, typename MakeSigned< T >::type yoff) noexcept |
Position & | move (Direction const &d, signed times=1) noexcept |
Static Public Member Functions | |
static Position const & | Origin () noexcept |
Public Attributes | |
T | x |
T | y |
Friends | |
auto | operator== (Position const &a, Position const &b) noexcept-> typename std::enable_if< std::is_integral< T >::value, bool >::type |
bool | operator< (Position const &a, Position const &b) noexcept |
Represents a two-dimensional point or position.
T | coordinate type, must be a scalar type. |
using chesspp::util::Position< T >::value_type = T |
|
inlinenoexcept |
Initializes x and y to the provided values, or from T's default constructor otherwise.
x_ | the x coordinate of this position, or T() |
y_ | the y coordinate of this position, or T() |
|
default |
|
default |
|
default |
|
inlinenoexcept |
Checks if this position is within a boundry of top-left and bottom-right positions, including edges.
topleft | the lowest coordinate corner |
bottomright | the highest coordinate corner |
|
inlinenoexcept |
Moves this position relative to itself.
xoff | the value to add to x, of type signed T |
yoff | the value to add to y, of type signed T |
|
inlinenoexcept |
Move position relative to itself in a direction a given number of times.
d | the dirction in which to move. |
times | the number of times to move in direction d. |
|
default |
|
default |
|
inlinestaticnoexcept |
Returns the position at the origin. This position is the result of x and y being initialized by T's default constructor.
Less-than comparison operator, to be used for sorting purposes only.
a | the left-hand position. |
b | the right-hand position. |
|
friend |
Equality comparison operator.
a | the left-hand position. |
b | the right-hand position |
T chesspp::util::Position< T >::x |
T chesspp::util::Position< T >::y |