ham
ham copied to clipboard
remove boost dependencies for the library
- boost program options
- boost pp (for f2f) https://github.com/noma/ham/blob/7466a17f8d34ae107cb88bcb8b2a84da25a1b23d/include/ham/functor/function.hpp#L76-L122
Would shipping all boost dependencies in thirdparty and integrating them directly into the CMake build be an option for you?
Boost PP is header only, so shouldn't matter anyways.
We could change f2f
in the following ways:
-
We use the original definition of
f2f
#define f2f(function_ptr, ...) ham::function<decltype(function_ptr), function_ptr>(__VA_ARGS__)
and add
f2f_zero
for zero arguments#define f2f_zero(function_ptr) ham::function<decltype(function_ptr), function_ptr>()
:+1:
f2f
stays the same :+1:f2f
can be used with zero arguments if the user does not bother about the warning :-1: Introduces a new "name" -
We change the definition of
f2f
#define f2f(function_ptr) ham::function<decltype(function_ptr), function_ptr>
invocation would change to
f2f(&function)(arg0, arg1, arg2);
:+1:
f2f
now clearly differentiate between type and variables :-1: breaks backwards compatibility
Boost PP is header only, so shouldn't matter anyways.
Yep is also an viable option.
Note: as discussed yesterday for C++ 17:
template<auto function_ptr>
using f2f = ham::function<decltype(function_ptr), function_ptr>;
f2f<function>(args...)
So we have:
f2f(function, args...); // original syntax: BOOST_PP_OVERLOAD for portability and no compiler warnings
f2f(function)(args...); // C++11, still Macros, but nor variadic macro necessary
f2f<function>(args...); // C++17, no macros :-)
TODO: decide what to offer, naming to avoid conflicts, and whether or not to drop backward compatibility
With respect to the standard library's std::function
and std::bind
are closest relatives, f2f
is very similar to bind, while the result is close to std::function:
For C++17 I'd propose the following:
- remove f2f alltogether to get rid of the macro and not overload the old construct with something new
- maybe add a dummy function instead of the macro and mark it deprecated to generate useful compiler errors for old code
- introduce
ham::function
instead
ham::sync(ham::function<function_ptr>(arg1, arg2, ...)) // 3rd from above
@marehr opinions?
sounds good.
Removed Boost Program Options in favor of header only CLI11 lib. Only Boost PP remains, but is header only and shipped in thirdparty folder, for C++11/14 compatibility.