Skip to content

contiguous_iterator should be constexpr #63

@qustrolabe

Description

@qustrolabe

std::views::join on beman::optional26::optional doesn't work in constexpr context in my code https://godbolt.org/z/Ed11G66s3 (switch preprocessor if 1 to see error)

This code doesn't work in constexpr:

auto range_result = view_of_optionals | std::views::join | std::views::take(100);

I expected it work like this C++23 code:

auto range_result = view_of_optionals
        | std::views::filter([](const optional26<int>& opt) { return opt.has_value(); })
        | std::views::transform([](const optional26<int>& opt) { return *opt; })
        | std::views::take(100);

Filtering out all nullopt from view

With std::views::join compiler gives error that contiguous_iterator is not constexpr, so I simply tried editing it's declaration - marking everything I could as constexpr and afterwards this code worked as expected. So solely based on this I think it should be constexpr.

Metadata

Metadata

Assignees

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