cppkafka icon indicating copy to clipboard operation
cppkafka copied to clipboard

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

Open TheSharpOwl opened this issue 4 years ago • 4 comments

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 avatar Aug 05 '21 13:08 TheSharpOwl

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 ?

TheSharpOwl avatar Aug 06 '21 12:08 TheSharpOwl

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?

mfontanini avatar Aug 06 '21 15:08 mfontanini

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

TheSharpOwl avatar Aug 06 '21 15:08 TheSharpOwl

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

TheSharpOwl avatar Aug 10 '21 09:08 TheSharpOwl