Skip to content

Instantly share code, notes, and snippets.

@acgetchell
Last active October 5, 2018 10:30
Show Gist options
  • Select an option

  • Save acgetchell/6d31a905deee37388ef8ba695182ec81 to your computer and use it in GitHub Desktop.

Select an option

Save acgetchell/6d31a905deee37388ef8ba695182ec81 to your computer and use it in GitHub Desktop.
#include <utility>
#include "Function_ref.h"
#include "S3ErgodicMoves.h"
#include "SimplicialManifold.h"
auto increment_lambda = [](int a) { return ++a; };
function_ref<int(int)> lambda_ref(increment_lambda);
increment_lambda(0); // = 1
lambda_ref(5); // = 6
SimplicialManifold test_universe(6400, 13);
Move_tuple moves(std::make_tuple(0, 0, 0, 0, 0));
auto move_23_lambda = [](SimplicialManifold manifold,
Move_tuple& attempted_moves) -> SimplicialManifold {
return make_23_move(std::move(manifold), attempted_moves);
};
function_ref<SimplicialManifold(SimplicialManifold, Move_tuple&)> complex_ref(
move_23_lambda);
test_universe = move_23_lambda(test_universe, moves); // compiles, fails at runtime
test_universe2 = complex_ref(test_universe, moves); // works perfectly!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment