On 07/29/2016 04:56 PM, Alex Rousskov wrote: > On 07/29/2016 12:29 PM, Alex Rousskov wrote: > I found two macro-free ways to do this. The so called "smart" one does > most of the work for us, but requires repeating the function name twice, > once with decltype() and once without: > > typedef HardFun<decltype(BIO_vfree), &BIO_vfree> BIO_Deleter; > > A simpler implementation is arguably more verbose/repetitive: > > typedef HardFun<void, BIO*, &BIO_vfree> BIO_Deleter; > > For comparison, the macro-based approach yields: > > CtoDeleter(BIO, BIO_vfree); // declares BIO_Deleter > > And the current buggy trunk code is equivalent to this perfection: > > typedef std::function<decltype(BIO_free)> BIO_Deleter; > > > Since the smarter implementation does not give a perfect result despite > its tricks/complexity, I suggest going with the simpler one. The macros > do not seem to be necessary (and HardFun offers better reuse > possibilities than a macro if we need more hard-coded functors).
FWIW, it is easy to test the macro-free approach by redefining the macro your patch adds to sources: > +#define CtoDeleter(argument_type, function) \ > +typedef HardFun<void, argument_type*, &function> argument_type ## _Deleter I tried that hack. Squid built, started, and processed a few trivial transactions OK. Alex. _______________________________________________ squid-dev mailing list [email protected] http://lists.squid-cache.org/listinfo/squid-dev
