42double calc_distance(
const double dx,
const double dy)
noexcept;
48 return std::abs(
lhs -
rhs) < max;
54 const std::vector<T>& collection
58 std::begin(collection),
61 ) != std::end(collection);
73 const int increment = 1
78std::vector<std::string>
read_lines(
const std::string& filename);
95 const char seperator =
' '
bool is_present_in(const T &element, const std::vector< T > &collection)
Determine if a value if part of a collection.
Definition helper.h:52
void remove_first(T &v)
Remove the first element from a collection.
Definition helper.h:84
std::vector< int > make_sequence(const int from, const int to, const int increment=1)
Make a sequence in an inclusive way.
Definition helper.cpp:30
double calc_angle_degrees(const double dx, const double dy)
Calculate the angle in degrees.
Definition helper.cpp:14
bool is_close(const T &lhs, const T &rhs, const T &max)
Determine if the difference between two values is less than the maximum tolerated value.
Definition helper.h:46
std::string bool_to_str(const bool b) noexcept
Convert 'true' to 'true' and 'false' to 'false'.
Definition helper.cpp:9
double calc_distance(const double dx, const double dy) noexcept
Calculate the Euclidean distance between two points.
Definition helper.cpp:24
std::wstring to_wstring(const std::string s)
Convert a string to a wide string.
Definition helper.cpp:192
std::vector< std::string > split_str(const std::string &s, const char seperator=' ')
Split a string.
Definition helper.cpp:72
std::vector< std::string > read_lines(const std::string &filename)
Convert a file's content to a collection of strings.
Definition helper.cpp:59
double calc_angle_radians(const double dx, const double dy)
Calculate the angle in radians.
Definition helper.cpp:19
void test_helper()
Test the help functions.
Definition helper.cpp:89