commit b02c083a3545b6e6b36ab62680128edec619a804 parent 8028f9d13a5bf776e2f62581781b247d2d4ae65f Author: Sebastiano Tronto <sebastiano@tronto.net> Date: Tue, 15 Apr 2025 14:47:58 +0200 Fixed function pointer thing Diffstat:
M | cpp/examples/solve_h48h3k2.cpp | | | 6 | +----- |
M | cpp/nissy.cpp | | | 5 | +---- |
M | cpp/nissy.h | | | 2 | +- |
3 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/cpp/examples/solve_h48h3k2.cpp b/cpp/examples/solve_h48h3k2.cpp @@ -6,13 +6,9 @@ #include <iostream> #include <string> -extern "C" { - long long nissy_setlogger(void (*)(const char *)); -} - int main() { // Get verbose output - nissy_setlogger([](const char* s) { std::cout << s; }); + nissy::set_logger([](const char* s) { std::cout << s; }); // Get the scramble from the user std::cout << "Enter scramble: "; diff --git a/cpp/nissy.cpp b/cpp/nissy.cpp @@ -227,8 +227,5 @@ namespace nissy { return error{err}; } - void set_logger(const std::function<void(const char *)>& log) - { - nissy_setlogger(log.target<void(const char *)>()); - } + void set_logger(void (*log)(const char *)) { nissy_setlogger(log); } } diff --git a/cpp/nissy.h b/cpp/nissy.h @@ -100,7 +100,7 @@ namespace nissy { }; error count_moves(const std::string&); - void set_logger(const std::function<void(const char*)>&); + void set_logger(void (*)(const char*)); } #endif