ManaPlus
Functions
position.cpp File Reference

(986a3bf)

#include "position.h"
#include "debug.h"

Go to the source code of this file.

Functions

std::ostream & operator<< (std::ostream &os, const Position &p)
 
std::ostream & operator<< (std::ostream &os, const Path &path)
 

Function Documentation

◆ operator<<() [1/2]

std::ostream& operator<< ( std::ostream &  os,
const Path path 
)

Appends a string representation of a path (sequence of positions) to the output stream.

Definition at line 34 of file position.cpp.

35 {
36  Path::const_iterator i = path.begin();
37  const Path::const_iterator i_end = path.end();
38 
39  os << "(";
40  while (i != i_end)
41  {
42  os << *i;
43  ++i;
44  if (i != i_end)
45  os << ", ";
46  }
47  os << ")";
48 
49  return os;
50 }

◆ operator<<() [2/2]

std::ostream& operator<< ( std::ostream &  os,
const Position p 
)

Appends a string representation of a position to the output stream.

Definition at line 28 of file position.cpp.

29 {
30  os << "(" << p.x << ", " << p.y << ")";
31  return os;
32 }
int y
Definition: position.h:46
int x
Definition: position.h:45

References Position::x, and Position::y.