Skip to content
New issue

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

Consider to use examples in the documented runtime methods #54

Open
mikir opened this issue Dec 11, 2024 · 0 comments
Open

Consider to use examples in the documented runtime methods #54

mikir opened this issue Dec 11, 2024 · 0 comments
Milestone

Comments

@mikir
Copy link
Collaborator

mikir commented Dec 11, 2024

Some runtime methods are not very intuitive for users. Therefore, some examples in the documentation will help.

Check the generated doxygen documentation and try to use example where it makes sense. For example here:

/**
 * Utility to safely construct zserio numeric type wrapper from its underlying value with range checking.
 *
 * Overload for dynamic length types wrappers.
 *
 * \param value Underlying value to convert to the type wrapper.
 * \param numBits Number of bits as a length of a dynamic length numeric type.
 *
 * \return Numeric type wrapper constructed after range checking (if needed).
 *
 * \throw OutOfRangeException when the underlying value is out of range of the zserio numeric type.
 */
template <typename T,
        std::enable_if_t<std::is_base_of_v<detail::NumericTypeWrapper<typename T::ValueType>, T>, int> = 0>
constexpr T fromCheckedValue(typename T::ValueType value, BitSize numBits)
{
    detail::RangeChecker<T>::check(value, numBits);

    return T(value);
}

Reported by @reinco.

@mikir mikir added this to the Backlog milestone Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant