mfontanini / cppkafka

Modern C++ Apache Kafka client library (wrapper for librdkafka)
BSD 2-Clause "Simplified" License
587 stars 207 forks source link

Use cpp17 and no need for Boost if you disable examples. #284

Open TheSharpOwl opened 3 years ago

TheSharpOwl commented 3 years ago

I replaced the boost::optional and boost::any with C++17 ones (project is set to use C++17). However, examples still use boost and I have no idea yet how to refactor that. Why I did it ? To save space if someone just wants to install the library.

TheSharpOwl commented 3 years ago

I replaced the boost::optional and boost::any with C++17 ones (project is set to use C++17). However, examples still use boost and I have no idea yet how to refactor that. Why I did it ? To save space if someone just wants to install the library.

Edit: if you don't want to break compatibility, I am planning to add which C++ to use for example so that it would be available in old way or new one ?

mfontanini commented 3 years ago

Given this is quite the breaking change, it should be an optional feature that we can eventually enable by default in say version 1.0. Using std::optional is nice but it will break any existing user's codes, plus it involves them using a newer standard (which is reasonable given C++17 is 4 years old, but still).

Could you turn this into a configurable option? e.g. cmake -DUSE_STD_OPTIONAL and have some header that defines cppkafka::optional to be std::optional or boost::optional depending on it and using cppkafka::optional internally rather than the concrete optional type we're using?

TheSharpOwl commented 3 years ago

Sure then I will do it and let you know)) Thanks.

TheSharpOwl commented 3 years ago

I did it and if someone wants to use only C++17 without any boost, they should do this: cmake -DUSE_CPP17=ON -DCPPKAFKA_DISABLE_EXAMPLES=ON -DCPPKAFKA_DISABLE_TESTS=ON "DIR" Also, I fixed some conflicts with max and min on windows so I fixed them. @mfontanini