Let `size_in_bits` take a `bytes` argument, rather than just being a templated function to multiply `sizeof(T)` by `CHAR_BIT`.
- Dominant language
- C++
- Stars
- 9.8k
- Forks
- 1.1k
- Avg merge
- 3d 6m
- Merged PRs (30d)
- 278
Description
As noted by [@harrism in #13577](https://github.com/rapidsai/cudf/pull/13577#discussion_r1230283942_).
> I would agree with you @bdice if `size_in_bits` took a size in bytes argument. But as it is, you have to write `data_buffer->size() * size_in_bits()`, which is kinda dumb. `size_in_bits(data_buffer->size())` would be OK. I think `* CHAR_BIT` is OK too.
This could be solved by removing the template argument from `size_in_bits` and just implementing it as a `constexpr` function that multiplies its argument by `CHAR_BIT`. All of the usages in `static_assert`s would still work (since the call would just change from `size_in_bits()` to `size_in_bits(sizeof(T))`).
Contributor guide
Assessment
This issue has not been assessed yet.