CaseyCarter / cmcstl2

An implementation of C++ Extensions for Ranges
Other
223 stars 68 forks source link

view::join functionality question #278

Open melton1968 opened 5 years ago

melton1968 commented 5 years ago

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?