Factory method for cuco::static_set
This PR adds a factory make_static_set<Key, Scope>(args…), which takes a parameter pack of ctor arguments in any order and returns a static_set object.
Closes #207
Marking this as a draft since there are several details I'd like to discuss in the reviews. Also, some docs are still missing.
Why is it a factory instead of just a constructor? Factory functions are largely defunct as of C++17 and the introduction of CTAD.
Why is it a factory instead of just a constructor? Factory functions are largely defunct as of C++17 and the introduction of CTAD.
I fiddled around with this and the problem with the initial design was that it required a deduction guide in order to correctly deduce the tparams from the find_arg constructs. The problem was that I also had to pass in some tparams explicitly, which couldn't be deduced from the args pack. Since partial deduction guides aren't a thing, I ran into a dead end.
The factory function, on the other hand, gives me an extra layer of indirection so I don't need any deduction guides.
That said, I'm working on a fix that enables us to deduce all of the tparams from the args pack, thus shipping around the problem with the deduction guide. Once this is working flawlessly with the factory function, I can give it another try integrating it into the ctor directly.
Another point to consider is if we directly integrate this into the ctor, we always pay for the extra compile time introduced by the find_arg function.
I don't know if downstream projects like RAPIDS will pay this fee. Providing the old-school ctor gives them a fallback in case compilation times are of concern.