-
-
Save rightfold/483e57cd77114e81fac6 to your computer and use it in GitHub Desktop.
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
set_global("std::bind", [] (auto arguments_begin, auto arguments_end) { | |
auto callee = *arguments_begin; | |
std::vector<handle> bound_arguments(arguments_begin + 1, arguments_end); | |
return handle(subroutine( | |
[callee = std::move(callee), bound_arguments = std::move(bound_arguments)] | |
(auto new_arguments_begin, auto new_arguments_end) { | |
auto arguments = bound_arguments; | |
arguments.insert(arguments.end(), new_arguments_begin, new_arguments_end); | |
return callee->template data<subroutine>()(arguments.begin(), arguments.end()); | |
} | |
)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment