This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is meant to minimic std::minimum_element, but allows you to transform the | |
// element in some way. We could use std::minimum_element, but the transform function | |
// would be evaluated twice as many times as it needs to be as it's results aren't | |
// cached. This caches the value. | |
template<class ForwardIt, class UnaryOperation> | |
ForwardIt min_transformed_element(ForwardIt first, ForwardIt last, UnaryOperation unary_op) | |
{ | |
if (first == last) return last; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <sstream> | |
#include <vector> | |
#include <string> | |
#include <iterator> | |
#include <algorithm> | |
struct Pos{ | |
float x = 0; | |
float y = 0; |