covid-sim
Toggle main menu visibility
Loading...
Searching...
No Matches
src
MicroCellPosition.cpp
1
#include "MicroCellPosition.hpp"
2
#include <stdexcept>
3
4
MicroCellPosition
MicroCellPosition::operator+(Direction direction)
const
{
5
switch
(direction) {
6
case
Right:
return
{this->x + 1, this->y};
7
case
Up:
return
{this->x, this->y - 1};
8
case
Left:
return
{this->x - 1, this->y};
9
case
Down:
return
{this->x, this->y + 1};
10
}
11
throw
std::out_of_range(
"direction"
);
12
}
13
14
MicroCellPosition
&MicroCellPosition::operator+=(Direction direction) {
15
return
*
this
= *
this
+ direction;
16
}
MicroCellPosition
Definition
MicroCellPosition.hpp:5
Generated by
1.17.0