We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In the spirit of #249, I want to start a discussion regarding our block (for now) codec interface.
Here's what it looks like now if represented by C++20 concepts TS:
template <typename T> concept bool Encodable = requires(T codec, std::uint32_t const *in, std::uint32_t sum, std::size_t n, std::vector<std::uint8_t> &out) { { T::encode(in, sum, n, out) } -> void; }; template <typename T> concept bool Decodable = requires(T codec, std::uint8_t const *in, std::uint32_t *out, std::uint32_t sum, std::size_t n) { { T::decode(in, out, sum, n) } -> uint8_t const *; }; template <class T> concept bool BlockCodecLike = Encodable<T> && Decodable<T>;
But I think we can make it better and more generic by changing several things:
template <typename C, typename V = std::uint32_t> concept bool Encodable_ = requires(C codec, V const *in, std::byte *out, std::size_t count, std::optional<V> max_value) { { C::encode(in, out, count) } -> std::size_t; { C::max_encoded_bytes(count, max_value) } -> std::size_t; }; template <typename C, typename V = std::uint32_t> concept bool Decodable_ = requires(C codec, std::byte const *in, T *out, std::size_t count) { { C::encode(in, out, count) } -> std::size_t; };
Note that I removed the sum_of_values. @amallia Is it used anywhere other than interpolative?
sum_of_values
Any thoughts?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
In the spirit of #249, I want to start a discussion regarding our block (for now) codec interface.
Here's what it looks like now if represented by C++20 concepts TS:
But I think we can make it better and more generic by changing several things:
Note that I removed the
sum_of_values
. @amallia Is it used anywhere other than interpolative?Any thoughts?
The text was updated successfully, but these errors were encountered: