Skip to content

Too strict validators #161

@SGSSGene

Description

@SGSSGene

The concept sharg::validator seems to strict:

template <typename validator_type>
concept validator = std::copyable<std::remove_cvref_t<validator_type>> &&
requires { typename std::remove_reference_t<validator_type>::option_value_type; } &&
requires(validator_type validator,
typename std::remove_reference_t<validator_type>::option_value_type value)
{
{validator(value)} -> std::same_as<void>;
{validator.get_help_page_message()} -> std::same_as<std::string>;
};

It enforces that a validator has a member type option_value_type. This is the only used as a parameter for operator().
This approach doesn't properly support validators that have template operator().

This collide with validators as used in raptor positive_integer_validator, which is a generic validator for any integer.

https://github.com/seqan/raptor/blob/e14ab05c538b3847348ab144a8f2a62ac6cc794a/include/raptor/argument_parsing/validators.hpp#L71-L107

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions