Skip to content

view::join functionality question #278

@melton1968

Description

@melton1968

This code compiles fine:

    {
        auto strs = { "1", "2", "3", "4", "5" };
        auto g0 = strs
            | v::join;
    }

This code does not:

    {
        strings strs = { "1", "2", "3", "4", "5" };
        auto g0 = strs
            | v::transform([](auto v) { return v; })
            | v::join;
    }

Simplifying for better compiler diagnostics:

    {
        strings strs = { "1", "2", "3", "4", "5" };
        auto g0 = strs
            | v::transform([](auto v) { return v; });
        auto g1 = r::join_view{ g0 };
    }

The compiler take umbrage here (join.hpp:58)

requires View<V> && InputRange<iter_reference_t<iterator_t<V>>> &&
                (detail::_GLvalueRange<V> || View<iter_value_t<iterator_t<V>>>) // TODO: file LWG i\
ssue

This complaint is twofold:

  1. the underlying Range doesn't return a reference from operator* (make sense for transform).
  2. the underlying iterator value type (string) is not a View.

Is this the expected behavior?
Know issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions