Modernize LoKi
- only mention template arguments if really needed
- prefer templated member functions of non-templated classes over templated classes with non-template member functions
- use CTAD (class template argument deduction) when possible
- add deduction guides to enable more CTAD
- replace
stable_sort
, when followed byunique
, withsort
. - should be applied together with Rec!1467 (merged), Phys!543 (merged), Hlt!623 (merged), Stripping!1091 (merged), Analysis!497 (merged)
- avoid using
auto
return type when interacting with cppyy.
The first point is part of not explicitly mentioning LoKi::Functor<Arg,Res>
in the signature of functions, and instead perform a 'concept check' that the
type supplied implements the right interface. As a result, this will at some
later stage allow the current (abstract) interface LoKi::Functor<Arg,Res>
to
be removed (and be replaced with an explicit type-erasure wrapper, eg. the
current LoKi::FunctorFromFunctor<Arg,Res>
), without impacting these functions.
The last point is due to a current 'feature' of cppyy, which implies
that it isn't able to resolve auto
return type properly in certain
circumstances, as illustrated by:
stbc-i5 93> ./build.x86_64+avx2+fma-centos7-gcc8-opt/run python
Python 2.7.15 (default, Feb 7 2019, 20:30:25)
[GCC 8.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cppyy
>>> cppyy.gbl.gInterpreter.ProcessLine("template <typename T> struct Wrap { static auto id(T t) { return t; } };")
>>> Wrap { static auto id(T t) { return t; } };")
0L
>>> w=cppyy.gbl.Wrap(int)()
>>> three = w.id(3)
__main__:1: RuntimeWarning: creating executor for unknown type "auto"
>>> type(three)
<type 'NoneType'>
>>>
A patch is for this is available here which will (hopefully) find its way into ROOT in the near future...
At that point, it should be possible to use auto
return types for
the static functions defined in the various LoKi::Dicts::...Ops
templates, which are there to interact with cppyy