2

range-v3 の概念をtypename gsl::span<const gsl::byte>::const_iterator満たしていないことがわかりました。Readableコンセプトを調べた後、次の制約が見つかりました。

template<typename I>
            auto requires_(I&&) -> decltype(
                concepts::valid_expr(
                    // The value, reference and rvalue reference types are related
                    // through the CommonReference concept.
                    concepts::model_of<CommonReference, reference_t<I> &&, value_t<I> &>(),
                    concepts::model_of<CommonReference, reference_t<I> &&, rvalue_reference_t<I> &&>(),
                    concepts::model_of<CommonReference, rvalue_reference_t<I> &&, value_t<I> const &>(),
                    // Experimental additional tests. If nothing else, this is a good workout
                    // for the common_reference code.
                    concepts::model_of<Same, ranges::common_reference_t<reference_t<I>, value_t<I>>, value_t<I>>(),
                    concepts::model_of<Same, ranges::common_reference_t<rvalue_reference_t<I>, value_t<I>>, value_t<I>>()
                ));

ranges::common_reference_tconstから を削除するvalue_typeと、それらは同じではありません。

CommonReference制約とはどういう意味ですか? なぜReadable彼らを満足させなければならないのですか?

4

1 に答える 1

2

あなたの問題はGSLにあります。span_iterator( https://github.com/Microsoft/GSL/blob/master/gsl/span#L145-L147 )のソースから:

using value_type = std::conditional_t<IsConst, std::add_const_t<typename Span::element_type>, typename Span::element_type>;

-qualifiedspan::const_iteratorconst同様value_typeです。それは奇妙で間違っています。また、規格に適合していない可能性もあります。その主張の基準内で決定的な証拠をまだ見つけていませんが、基準は非常に示唆に富んでいます。たとえば、std::iterator_traitsconst へのポインターの特殊化は次のとおりです。

template<class T> struct iterator_traits<const T*> { using difference_type = ptrdiff_t; using value_type = T; using pointer = const T*; using reference = const T&; using iterator_category = random_access_iterator_tag; };

見る?へのポインターであっても、修飾されてvalue_typeいません。constconst

于 2016-12-08T22:12:03.993 に答える