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
Constructor not considered for lexy::dsl::nullopt
#118
Comments
Emphasis mine:
It is only types that are optional-like, not all default constructible types. This restriction is unfortunate, but necessary because otherwise The particular situation of |
@foonathan the thing I would like to avoid is unreadable and unnecessary constructors like this one: Group(std::optional<std::vector<int>> xs): _xs(xs ? std::move(*xs) : std::vector<int>()) {}; My understanding is that To me the wording of values produced by As a side note, I just discovered |
Yes, you either have single function accepting an
Yes, I will make the docs clearer.
|
The documentation of
lexy::dsl::nullopt
says:So when I want to create a list using
lexy::dsl::opt
, I would expect a constructor that takesvector
to match, becausevector
is default constructible. But it does not. Neither does the default constructor or one takingstd::nullopt_t
.The only ones that I found to match were
std::optional<std::vector<...>>
andlexy::dsl::nullopt
:https://godbolt.org/z/c3M7banhf
The text was updated successfully, but these errors were encountered: