Open davidebeatrici opened 1 year ago
A benchmark would be nice to have, once we switch to a proper test framework.
-> https://github.com/google/benchmark I have used that one before and it is pretty amazing.
This is of course due to size_t
being unsigned long long
instead of unsigned long
.
Unfortunately the proper literal was only introduced in C++23: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p0330r8.html
We can get away with size_t{ value }
though.
Oh and another thing to consider: As you want to implement this header-only anyway, we could also template the functions to allow any type of the correct size (or anything that has at least the appropriate size). That way, we wouldn't have the uint8_t
vs std::byte
vs char
vs ... problem
The failing Windows builds are probably the due to a missing <stdexcept>
include.
Oh and another thing to consider: As you want to implement this header-only anyway, we could also template the functions to allow any type of the correct size (or anything that has at least the appropriate size). That way, we wouldn't have the
uint8_t
vsstd::byte
vschar
vs ... problem
Or rather, template wrappers for them: thanks to the spans we can get away with simple casts.
thanks to the spans we can get away with simple casts.
Doesn't seem like it: https://godbolt.org/z/5P5dWc5nj :eyes:
Sorry, by "simple" I meant casting the element type and specifying the size accordingly.
Maybe we should define our own span_cast
that does this under the hood. That will probably make our code a bit cleaner
Indeed, I was actually thinking about it. There are quite a few places in our codebase where it would be useful.
Just to be explicit: The only thing missing from my POV is the documentation (+ the mentioned in-source explanatory comments)
Written in modern C++, it strictly adheres to the Base64 specification.
This means that alternate alphabets and/or the lack of padding are rejected.
A benchmark would be nice to have, once we switch to a proper test framework.