Код: Выделить всё
#if 0 /*
g++ -std=c++23 $0 -o exe \
-Wall -Werror -Wextra -Wsign-conversion -pedantic-errors \
&& ./exe $@
RET=$?
rm -f exe
exit $RET
*/
#endif
#include
#include
#include
int main() {
auto v = std::vector{std::expected(0)};
auto r1 = std::views::all(std::vector{0});
// auto r2 = std::views::all(v);
}
Код: Выделить всё
In file included from ./expected-in-range.cpp:11:
/usr/include/c++/15.1.1/expected: In substitution of ‘template requires !(__is_expected) && requires(const _Tp& __t, const _Up& __u) {{__t == __u} -> decltype(auto) [requires std::convertible_to<
, bool>];} constexpr bool std::operator==(const expected&, const _Up&) [with _Up = __gnu_cxx::__normal_iterator]’:
/usr/include/c++/15.1.1/expected:1175:12: required by substitution of ‘template requires !(__is_expected) && requires(const _Tp& __t, const _Up& __u) {{__t == __u} -> decltype(auto) [requires std::convertible_to];} constexpr bool std::operator==(const expected&, const _Up&) [with _Up = __gnu_cxx::__normal_iterator]’
1175 | { __t == __u } -> convertible_to;
| ~~~~^~~~~~
/usr/include/c++/15.1.1/concepts:306:10: required by substitution of ‘template requires (__maybe_borrowed_range) && ((is_bounded_array_v) || (__member_end) || (__adl_end)) constexpr auto std::ranges::__access::_End::operator()(_Tp&&) const [with _Tp = std::vector&]’
306 | { __t == __u } -> __boolean_testable;
| ~~~~^~~~~~
/usr/include/c++/15.1.1/bits/ranges_base.h:517:13: required by substitution of ‘template requires (viewable_range) && ((view) || (__can_ref_view) || (__can_owning_view)) constexpr auto std::ranges::views::_All::operator()(_Range&&) const [with _Range = std::vector&]’
517 | ranges::end(__t);
| ~~~~~~~~~~~^~~~~
./expected-in-range.cpp:18:28: required from here
18 | auto r2 = std::views::all(v);
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/15.1.1/expected:1178:2: required by the constraints of ‘template template requires !(__is_expected) && requires(const _Tp& __t, const _Up& __u) {{__t == __u} -> decltype(auto) [requires std::convertible_to];} constexpr bool std::operator==(const expected&, const _Up&)’
/usr/include/c++/15.1.1/expected:1174:7: in requirements with ‘const _Tp& __t’, ‘const _Up& __u’ [with _Tp = int; _Up = __gnu_cxx::__normal_iterator]
/usr/include/c++/15.1.1/expected:1174:14: error: satisfaction of atomic constraint ‘requires(const _Tp& __t, const _Up& __u) {{__t == __u} -> decltype(auto) [requires std::convertible_to];} [with _Tp = _Tp; _Up = _Up]’ depends on itself
1174 | && requires (const _Tp& __t, const _Up& __u) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1175 | { __t == __u } -> convertible_to;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1176 | }
| ~
< /code>
Как я хотел понять эту ошибку? Что это значит? Как я могу сделать то, что я пытаюсь сделать? PrettyPrint-Override ">f(
all(std::vector{g(), g(), g()})
| filter([](auto e){ return e.has_value(); })
| transform([](auto e){ return e.value(); })
);
Подробнее здесь: https://stackoverflow.com/questions/796 ... to-a-range