Диапазоны сборов ошибок :: set_intersection с проекциейC++

Программы на C++. Форум разработчиков
Ответить Пред. темаСлед. тема
Anonymous
 Диапазоны сборов ошибок :: set_intersection с проекцией

Сообщение Anonymous »

Код: < /p>
#include
#include
#include
#include
#include
#include
#include
using namespace std;

struct Edge{int from, to;};
enum NeighborDegree{FIRST_NEIGHBOR_DEGREE,SECOND_NEIGHBOR_DEGREE,THIRD_NEIGHBOR_DEGREE};

int main()
{
const vector links;
vector multi_degree_neighbors, inter;
ranges::set_intersection(multi_degree_neighbors, multi_degree_neighbors, back_inserter(inter), {}, {}, {});
auto prj1=[](const auto& neighbor)->Edge{const auto& [e,degree]=neighbor;return e;};
ranges::set_intersection(multi_degree_neighbors, links, back_inserter(inter), {}, prj1, {});
}
< /code>
Ошибка: < /p>
prog.cc: In function 'int main()':
prog.cc:17:29: error: no match for call to '(const std::ranges::__set_intersection_fn) (std::vector&, std::vector&, std::back_insert_iterator,
,
,
)'
17 | ranges::set_intersection(multi_degree_neighbors, multi_degree_neighbors, back_inserter(inter), {}, {}, {});
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /opt/wandbox/gcc-head/include/c++/16.0.0/algorithm:65,
from prog.cc:1:
/opt/wandbox/gcc-head/include/c++/16.0.0/bits/ranges_algo.h:2751:10: note: there are 2 candidates
2751 | struct __set_intersection_fn
| ^~~~~~~~~~~~~~~~~~~~~
/opt/wandbox/gcc-head/include/c++/16.0.0/bits/ranges_algo.h:2759:7: note: candidate 1: 'template requires (input_iterator) && (sentinel_for) && (input_iterator) && (sentinel_for) && (weakly_incrementable) && (mergeable) constexpr std::ranges::set_intersection_result std::ranges::__set_intersection_fn::operator()(_Iter1, _Sent1, _Iter2, _Sent2, _Out, _Comp, _Proj1, _Proj2) const'
2759 | operator()(_Iter1 __first1, _Sent1 __last1,
| ^~~~~~~~
/opt/wandbox/gcc-head/include/c++/16.0.0/bits/ranges_algo.h:2759:7: note: template argument deduction/substitution failed:
prog.cc:17:29: note: couldn't deduce template parameter '_Sent2'
17 | ranges::set_intersection(multi_degree_neighbors, multi_degree_neighbors, back_inserter(inter), {}, {}, {});
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/wandbox/gcc-head/include/c++/16.0.0/bits/ranges_algo.h:2793:7: note: candidate 2: 'template requires (input_range) && (input_range) && (weakly_incrementable) && (mergeable) constexpr std::ranges::set_intersection_result std::ranges::__set_intersection_fn::operator()(_Range1&&, _Range2&&, _Out, _Comp, _Proj1, _Proj2) const'
2793 | operator()(_Range1&& __r1, _Range2&& __r2, _Out __result,
| ^~~~~~~~
/opt/wandbox/gcc-head/include/c++/16.0.0/bits/ranges_algo.h:2793:7: note: template argument deduction/substitution failed:
/opt/wandbox/gcc-head/include/c++/16.0.0/bits/ranges_algo.h:2793:7: note: constraints not satisfied
In file included from /opt/wandbox/gcc-head/include/c++/16.0.0/compare:42,
from /opt/wandbox/gcc-head/include/c++/16.0.0/bits/stl_pair.h:65,
from /opt/wandbox/gcc-head/include/c++/16.0.0/bits/stl_algobase.h:64,
from /opt/wandbox/gcc-head/include/c++/16.0.0/algorithm:62:
/opt/wandbox/gcc-head/include/c++/16.0.0/concepts: In substitution of 'template requires (input_range) && (input_range) && (weakly_incrementable) && (mergeable) constexpr std::ranges::set_intersection_result std::ranges::__set_intersection_fn::operator()(_Range1&&, _Range2&&, _Out, _Comp, _Proj1, _Proj2) const [with _Range1 = std::vector&; _Range2 = std::vector&; _Out = std::back_insert_iterator; _Comp = std::ranges::less; _Proj1 = std::identity; _Proj2 = std::identity]':
prog.cc:17:29: required from here
17 | ranges::set_intersection(multi_degree_neighbors, multi_degree_neighbors, back_inserter(inter), {}, {}, {});
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/wandbox/gcc-head/include/c++/16.0.0/concepts:362:13: required for the satisfaction of 'invocable' [with _Fn = std::ranges::less&; _Args = {std::tuple&, std::tuple&}]
/opt/wandbox/gcc-head/include/c++/16.0.0/concepts:366:13: required for the satisfaction of 'regular_invocable' [with _Fn = std::ranges::less&; _Args = {std::tuple&, std::tuple&}]
/opt/wandbox/gcc-head/include/c++/16.0.0/concepts:370:13: required for the satisfaction of 'predicate' [with _Rel = std::ranges::less&; _Tp = std::tuple&]
/opt/wandbox/gcc-head/include/c++/16.0.0/concepts:375:13: required for the satisfaction of 'relation' [with _Rel = std::ranges::less&; _Tp = std::tuple&; _Up = std::tuple&]
/opt/wandbox/gcc-head/include/c++/16.0.0/concepts:385:13: required for the satisfaction of 'strict_weak_order' [with _Fn = std::ranges::less; _I1 = std::__detail::__projected::__type; _I2 = std::__detail::__projected::__type]
/opt/wandbox/gcc-head/include/c++/16.0.0/bits/iterator_concepts.h:789:13: required for the satisfaction of 'indirect_strict_weak_order' [with _Rel = std::ranges::less; _I1 = __gnu_cxx::__normal_iterator; _P1 = std::identity; _I2 = __gnu_cxx::__normal_iterator; _P2 = std::identity]
/opt/wandbox/gcc-head/include/c++/16.0.0/bits/iterator_concepts.h:998:13: required for the satisfaction of 'mergeable' [with _Range1 = std::vector&; _Range2 = std::vector&; _Out = std::back_insert_iterator; _Comp = std::ranges::less; _Proj1 = std::identity; _Proj2 = std::identity]
/opt/wandbox/gcc-head/include/c++/16.0.0/concepts:362:25: note: the expression 'is_invocable_v [with _Fn = std::ranges::less&; _Args = {std::tuple&, std::tuple&}]' evaluated to 'false'
362 | concept invocable = is_invocable_v;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.cc:19:29: error: no match for call to '(const std::ranges::__set_intersection_fn) (std::vector&, const std::vector&, std::back_insert_iterator,
, main()::&,
)'
19 | ranges::set_intersection(multi_degree_neighbors, links, back_inserter(inter), {}, prj1, {});
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/wandbox/gcc-head/include/c++/16.0.0/bits/ranges_algo.h:2751:10: note: there are 2 candidates
2751 | struct __set_intersection_fn
| ^~~~~~~~~~~~~~~~~~~~~
/opt/wandbox/gcc-head/include/c++/16.0.0/bits/ranges_algo.h:2759:7: note: candidate 1: 'template requires (input_iterator) && (sentinel_for) && (input_iterator) && (sentinel_for) && (weakly_incrementable) && (mergeable) constexpr std::ranges::set_intersection_result std::ranges::__set_intersection_fn::operator()(_Iter1, _Sent1, _Iter2, _Sent2, _Out, _Comp, _Proj1, _Proj2) const'
2759 | operator()(_Iter1 __first1, _Sent1 __last1,
| ^~~~~~~~
/opt/wandbox/gcc-head/include/c++/16.0.0/bits/ranges_algo.h:2759:7: note: template argument deduction/substitution failed:
prog.cc:19:29: note: couldn't deduce template parameter '_Sent2'
19 | ranges::set_intersection(multi_degree_neighbors, links, back_inserter(inter), {}, prj1, {});
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/wandbox/gcc-head/include/c++/16.0.0/bits/ranges_algo.h:2793:7: note: candidate 2: 'template requires (input_range) && (input_range) && (weakly_incrementable) && (mergeable) constexpr std::ranges::set_intersection_result std::ranges::__set_intersection_fn::operator()(_Range1&&, _Range2&&, _Out, _Comp, _Proj1, _Proj2) const'
2793 | operator()(_Range1&& __r1, _Range2&& __r2, _Out __result,
| ^~~~~~~~
/opt/wandbox/gcc-head/include/c++/16.0.0/bits/ranges_algo.h:2793:7: note: template argument deduction/substitution failed:
/opt/wandbox/gcc-head/include/c++/16.0.0/bits/ranges_algo.h:2793:7: note: constraints not satisfied
In file included from /opt/wandbox/gcc-head/include/c++/16.0.0/bits/stl_iterator_base_types.h:73,
from /opt/wandbox/gcc-head/include/c++/16.0.0/bits/stl_algobase.h:65:
/opt/wandbox/gcc-head/include/c++/16.0.0/bits/iterator_concepts.h: In substitution of 'template requires (input_range) && (input_range) && (weakly_incrementable) && (mergeable) constexpr std::ranges::set_intersection_result std::ranges::__set_intersection_fn::operator()(_Range1&&, _Range2&&, _Out, _Comp, _Proj1, _Proj2) const [with _Range1 = std::vector&; _Range2 = const std::vector&; _Out = std::back_insert_iterator; _Comp = std::ranges::less; _Proj1 = main()::; _Proj2 = std::identity]':
prog.cc:19:29: required from here
19 | ranges::set_intersection(multi_degree_neighbors, links, back_inserter(inter), {}, prj1, {});
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/wandbox/gcc-head/include/c++/16.0.0/bits/iterator_concepts.h:599:13: required for the satisfaction of 'indirectly_writable' [with _Out = std::back_insert_iterator; _In = __gnu_cxx::__normal_iterator]
/opt/wandbox/gcc-head/include/c++/16.0.0/bits/iterator_concepts.h:874:13: required for the satisfaction of 'indirectly_copyable' [with _I2 = __gnu_cxx::__normal_iterator; _Out = std::back_insert_iterator]
/opt/wandbox/gcc-head/include/c++/16.0.0/bits/iterator_concepts.h:998:13: required for the satisfaction of 'mergeable' [with _Range1 = std::vector&; _Range2 = const std::vector&; _Out = std::back_insert_iterator; _Comp = std::ranges::less; _Proj1 = main::._anon_221; _Proj2 = std::identity]
/opt/wandbox/gcc-head/include/c++/16.0.0/bits/iterator_concepts.h:599:35: in requirements with '_Out&& __o', '_Tp&& __t' [with _Out = std::back_insert_iterator; _Tp = const Edge&]
/opt/wandbox/gcc-head/include/c++/16.0.0/bits/iterator_concepts.h:601:14: note: the required expression '*__o =(forward)(__t)' is invalid
601 | *__o = std::forward(__t);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/opt/wandbox/gcc-head/include/c++/16.0.0/bits/iterator_concepts.h:602:34: note: the required expression '*(forward)(__o)=(forward)(__t)' is invalid
602 | *std::forward(__o) = std::forward(__t);
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/opt/wandbox/gcc-head/include/c++/16.0.0/bits/iterator_concepts.h:604:11: note: the required expression 'const_cast(*__o) =(forward)(__t)' is invalid
603 | const_cast(*__o)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
604 | = std::forward(__t);
| ^~~~~~~~~~~~~~~~~~~~~~~~
/opt/wandbox/gcc-head/include/c++/16.0.0/bits/iterator_concepts.h:606:11: note: the required expression 'const_cast(*(forward)(__o))=(forward)(__t)' is invalid
605 | const_cast(*std::forward(__o))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
606 | = std::forward(__t);
| ^~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: note: set '-fconcepts-diagnostics-depth=' to at least 2 for more detail


Подробнее здесь: https://stackoverflow.com/questions/796 ... projection
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение
  • Как использовать функцию Set Set State Set Set Satwerive AMD (ADL) (для программного переворачивания)
    Anonymous » » в форуме C#
    0 Ответы
    42 Просмотры
    Последнее сообщение Anonymous
  • Каков алгоритм set.intersection() в Python?
    Anonymous » » в форуме Python
    0 Ответы
    7 Просмотры
    Последнее сообщение Anonymous
  • Как преобразовать Set> в Set?
    Anonymous » » в форуме JAVA
    0 Ответы
    64 Просмотры
    Последнее сообщение Anonymous
  • Почему диапазоны::find и диапазоны::find_last имеют противоречивые типы возвращаемых значений?
    Anonymous » » в форуме C++
    0 Ответы
    43 Просмотры
    Последнее сообщение Anonymous
  • Async/await не работает в Intersection Observer [дубликат]
    Anonymous » » в форуме CSS
    0 Ответы
    16 Просмотры
    Последнее сообщение Anonymous

Вернуться в «C++»