-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use cpp17 and no need for Boost if you disable examples. #284
base: master
Are you sure you want to change the base?
Changes from all commits
b17427f
4430b91
709eb4d
03d046a
80d53a6
e5358fa
73aa4e5
77f0ea1
6213cd3
a9e276a
b73875b
1c91d33
e38438c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifdef _USE_CPP17 | ||
#include<any> | ||
#else | ||
#include <boost/any.hpp> | ||
#endif | ||
|
||
namespace cppkafka | ||
{ | ||
#ifdef _USE_CPP17 | ||
using any = std::any; | ||
#else | ||
using any = boost::any; | ||
#endif | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifdef _USE_CPP17 | ||
#include<optional> | ||
#else | ||
#include <boost/optional.hpp> | ||
#endif | ||
|
||
namespace cppkafka | ||
{ | ||
#ifdef _USE_CPP17 | ||
using std::optional; | ||
#else | ||
using boost::optional | ||
#endif | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,7 +143,11 @@ void Producer::do_produce(const Message& message, | |
const Buffer& payload = message.get_payload(); | ||
const Buffer& key = message.get_key(); | ||
const int policy = static_cast<int>(message_payload_policy_); | ||
#ifdef _USE_CPP17 | ||
int64_t duration = message.get_timestamp() ? message.get_timestamp().value().get_timestamp().count() : 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I presume both optionals have |
||
#else | ||
int64_t duration = message.get_timestamp() ? message.get_timestamp().get().get_timestamp().count() : 0; | ||
#endif | ||
auto result = rd_kafka_producev(get_handle(), | ||
RD_KAFKA_V_TOPIC(message.get_topic().data()), | ||
RD_KAFKA_V_PARTITION(message.get_partition()), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,10 @@ | |
* | ||
*/ | ||
|
||
#ifdef _WIN32 | ||
#define NOMINMAX | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably be set as a definition at the cmake level if it's needed, rather than here in this particular file |
||
#endif | ||
|
||
#include <algorithm> | ||
#include <limits> | ||
#include "utils/backoff_performer.h" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is enough. There needs to be a record somewhere (e.g. in a generated header file) that stores this and code should include that file to figure out this flag.
If you don't do that, you can have the library being compiled with this flag on but an application that uses the library not knowing (for obvious reasons) that they need to set this macro manually, which will break badly because from one's perspective you're using std types and from the other's boost ones.