aboutsummaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/examples/solve_h48h3k2.cpp6
-rw-r--r--cpp/nissy.cpp5
-rw-r--r--cpp/nissy.h2
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
9extern "C" {
10 long long nissy_setlogger(void (*)(const char *));
11}
12
13int main() { 9int 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

Generated with cgit - Back to sebastiano.tronto.net