Skip to content

Instantly share code, notes, and snippets.

jbeach jasonbeach

Block or report user

Report or block jasonbeach

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jasonbeach
jasonbeach / gist:215c23ea6b3b4b4b246f4455d32daba0
Created Apr 25, 2020
Find minimum element while transforming the elements
View gist:215c23ea6b3b4b4b246f4455d32daba0
// 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;
@jasonbeach
jasonbeach / string_zipper.cpp
Created Apr 18, 2020
Parse two lists of numbers and zip them into a vector of pairs
View string_zipper.cpp
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <iterator>
#include <algorithm>
struct Pos{
float x = 0;
float y = 0;
You can’t perform that action at this time.