Skip to content

Commit 8ab2725

Browse files
authored
switch callback function pointers to std::function types (#283)
1 parent 415e02f commit 8ab2725

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/httpserver/create_webserver.hpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
#include <stdlib.h>
2929
#include <memory>
30+
#include <functional>
3031
#include <string>
3132

3233
#include "httpserver/http_response.hpp"
@@ -40,10 +41,10 @@ namespace httpserver {
4041
class webserver;
4142
class http_request;
4243

43-
typedef const std::shared_ptr<http_response>(*render_ptr)(const http_request&);
44-
typedef bool(*validator_ptr)(const std::string&);
45-
typedef void(*log_access_ptr)(const std::string&);
46-
typedef void(*log_error_ptr)(const std::string&);
44+
typedef std::function<const std::shared_ptr<http_response>(const http_request&)> render_ptr;
45+
typedef std::function<bool(const std::string&)> validator_ptr;
46+
typedef std::function<void(const std::string&)> log_access_ptr;
47+
typedef std::function<void(const std::string&)> log_error_ptr;
4748

4849
class create_webserver {
4950
public:

0 commit comments

Comments
 (0)