diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-15 14:47:58 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-15 14:47:58 +0200 |
| commit | b02c083a3545b6e6b36ab62680128edec619a804 (patch) | |
| tree | e54b685a0a271e5681289169b7aa105555afde1a | |
| parent | 8028f9d13a5bf776e2f62581781b247d2d4ae65f (diff) | |
| download | nissy-core-b02c083a3545b6e6b36ab62680128edec619a804.tar.gz nissy-core-b02c083a3545b6e6b36ab62680128edec619a804.zip | |
Fixed function pointer thing
Diffstat (limited to '')
| -rw-r--r-- | cpp/examples/solve_h48h3k2.cpp | 6 | ||||
| -rw-r--r-- | cpp/nissy.cpp | 5 | ||||
| -rw-r--r-- | 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 index b747976..454d6dc 100644 --- a/cpp/examples/solve_h48h3k2.cpp +++ b/cpp/examples/solve_h48h3k2.cpp | |||
| @@ -6,13 +6,9 @@ | |||
| 6 | #include <iostream> | 6 | #include <iostream> |
| 7 | #include <string> | 7 | #include <string> |
| 8 | 8 | ||
| 9 | extern "C" { | ||
| 10 | long long nissy_setlogger(void (*)(const char *)); | ||
| 11 | } | ||
| 12 | |||
| 13 | int main() { | 9 | int main() { |
| 14 | // Get verbose output | 10 | // Get verbose output |
| 15 | nissy_setlogger([](const char* s) { std::cout << s; }); | 11 | nissy::set_logger([](const char* s) { std::cout << s; }); |
| 16 | 12 | ||
| 17 | // Get the scramble from the user | 13 | // Get the scramble from the user |
| 18 | std::cout << "Enter scramble: "; | 14 | std::cout << "Enter scramble: "; |
diff --git a/cpp/nissy.cpp b/cpp/nissy.cpp index b3bf6c4..2a52ab1 100644 --- a/cpp/nissy.cpp +++ b/cpp/nissy.cpp | |||
| @@ -227,8 +227,5 @@ namespace nissy { | |||
| 227 | return error{err}; | 227 | return error{err}; |
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | void set_logger(const std::function<void(const char *)>& log) | 230 | void set_logger(void (*log)(const char *)) { nissy_setlogger(log); } |
| 231 | { | ||
| 232 | nissy_setlogger(log.target<void(const char *)>()); | ||
| 233 | } | ||
| 234 | } | 231 | } |
diff --git a/cpp/nissy.h b/cpp/nissy.h index a809528..ff74f12 100644 --- a/cpp/nissy.h +++ b/cpp/nissy.h | |||
| @@ -100,7 +100,7 @@ namespace nissy { | |||
| 100 | }; | 100 | }; |
| 101 | 101 | ||
| 102 | error count_moves(const std::string&); | 102 | error count_moves(const std::string&); |
| 103 | void set_logger(const std::function<void(const char*)>&); | 103 | void set_logger(void (*)(const char*)); |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | #endif | 106 | #endif |
