Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include <algorithm> for gcc 14 compilation errors #428

Merged
merged 3 commits into from
Jun 20, 2024

Conversation

toge
Copy link
Contributor

@toge toge commented May 5, 2024

I met a lot of compilation errors on gcc 14:
It seems to be caused by a lack of including header.
This PR is fixed this problem.

Please review it.

CXXGraph 3.1.0 compilation errors on gcc 14

In file included from include/CXXGraph/Graph/Graph.h:23,
from include/CXXGraph/CXXGraph.hpp:11,
from test_package.cpp:3:
include/CXXGraph/Graph/Graph_impl.hpp: In member function ‘virtual void CXXGraph::Graph::setNodeData(const std::string&, T)’:
include/CXXGraph/Graph/Graph_impl.hpp:316:22: error: ‘find_if’ is not a member of ‘std’; did you mean ‘find’?
316 | auto nodeIt = std::find_if(
| ^~~~~~~
| find
include/CXXGraph/Graph/Graph_impl.hpp: In member function ‘virtual std::shared_ptr<std::vector<CXXGraph::Node > > CXXGraph::Graph::eulerianPath() const’:
include/CXXGraph/Graph/Graph_impl.hpp:465:27: error: ‘max_element’ is not a member of ‘std’; did you mean ‘tuple_element’?
465 | auto firstNodeIt = std::max_element(
| ^~~~~~~~~~~
| tuple_element
include/CXXGraph/Graph/Graph_impl.hpp: In member function ‘virtual const std::vector<CXXGraph::Node > CXXGraph::Graph::graph_slicing(const CXXGraph::Node&) const’:
include/CXXGraph/Graph/Graph_impl.hpp:775:29: error: ‘find_if’ is not a member of ‘std’; did you mean ‘find’?
775 | auto start_node_it = std::find_if(
| ^~~~~~~
| find
include/CXXGraph/Graph/Graph_impl.hpp:785:14: error: ‘find_if’ is not a member of ‘std’; did you mean ‘find’?
785 | if (std::find_if(C.begin(), C.end(), [node](const Node nodeC) {
| ^~~~~~~
| find
include/CXXGraph/Graph/Graph_impl.hpp:800:14: error: ‘find_if’ is not a member of ‘std’; did you mean ‘find’?
800 | if (std::find_if(M.begin(), M.end(), [nodeC](const Node nodeM) {
| ^~~~~~~
| find
In file included from include/CXXGraph/Graph/Graph.h:26:
include/CXXGraph/Graph/Algorithm/BellmanFord_impl.hpp: In member function ‘virtual const CXXGraph::BellmanFordResult CXXGraph::Graph::bellmanford(const CXXGraph::Node&, const CXXGraph::Node&) const’:
include/CXXGraph/Graph/Algorithm/BellmanFord_impl.hpp:36:30: error: ‘find_if’ is not a member of ‘std’; did you mean ‘find’?
36 | auto source_node_it = std::find_if(
| ^~~~~~~
| find
include/CXXGraph/Graph/Algorithm/BellmanFord_impl.hpp:44:30: error: ‘find_if’ is not a member of ‘std’; did you mean ‘find’?
44 | auto target_node_it = std::find_if(
| ^~~~~~~
| find
In file included from include/CXXGraph/Graph/Graph.h:27:
include/CXXGraph/Graph/Algorithm/BestFirstSearch_impl.hpp: In member function ‘virtual CXXGraph::BestFirstSearchResult CXXGraph::Graph::best_first_search(const CXXGraph::Node&, const CXXGraph::Node&) const’:
include/CXXGraph/Graph/Algorithm/BestFirstSearch_impl.hpp:40:30: error: ‘find_if’ is not a member of ‘std’; did you mean ‘find’?
40 | auto source_node_it = std::find_if(
| ^~~~~~~
| find
include/CXXGraph/Graph/Algorithm/BestFirstSearch_impl.hpp:48:30: error: ‘find_if’ is not a member of ‘std’; did you mean ‘find’?
48 | auto target_node_it = std::find_if(
| ^~~~~~~
| find
include/CXXGraph/Graph/Algorithm/BestFirstSearch_impl.hpp: In member function ‘virtual const std::vector<CXXGraph::Node > CXXGraph::Graph::concurrency_breadth_first_search(const CXXGraph::Node&, size_t) const’:
include/CXXGraph/Graph/Algorithm/BestFirstSearch_impl.hpp:111:29: error: ‘find_if’ is not a member of ‘std’; did you mean ‘find’?
111 | auto start_node_it = std::find_if(
| ^~~~~~~
| find
In file included from include/CXXGraph/Graph/Graph.h:29:
include/CXXGraph/Graph/Algorithm/BreadthFirstSearch_impl.hpp: In member function ‘virtual const std::vector<CXXGraph::Node > CXXGraph::Graph::breadth_first_search(const CXXGraph::Node&) const’:
include/CXXGraph/Graph/Algorithm/BreadthFirstSearch_impl.hpp:36:29: error: ‘find_if’ is not a member of ‘std’; did you mean ‘find’?
36 | auto start_node_it = std::find_if(
| ^~~~~~~
| find
In file included from include/CXXGraph/Graph/Graph.h:31:
include/CXXGraph/Graph/Algorithm/CycleDetection_impl.hpp: In member function ‘virtual bool CXXGraph::Graph::containsCycle(CXXGraph::T_EdgeSet*) const’:
include/CXXGraph/Graph/Algorithm/CycleDetection_impl.hpp:122:16: error: ‘find_if’ is not a member of ‘std’; did you mean ‘find’?
122 | if (std::find_if((*subset).begin(), (*subset).end(), nodeExists) ==
| ^~~~~~~
| find
include/CXXGraph/Graph/Algorithm/CycleDetection_impl.hpp: In member function ‘virtual bool CXXGraph::Graph::containsCycle(CXXGraph::shared<const std::unordered_set<std::shared_ptr<const CXXGraph::Edge >, CXXGraph::edgeHash > >) const’:
include/CXXGraph/Graph/Algorithm/CycleDetection_impl.hpp:148:16: error: ‘find_if’ is not a member of ‘std’; did you mean ‘find’?
148 | if (std::find_if((*subset).begin(), (*subset).end(), nodeExists) ==
| ^~~~~~~
| find
In file included from include/CXXGraph/Graph/Graph.h:32:
include/CXXGraph/Graph/Algorithm/DepthFirstSearch_impl.hpp: In member function ‘virtual const std::vector<CXXGraph::Node > CXXGraph::Graph::depth_first_search(const CXXGraph::Node&) const’:
include/CXXGraph/Graph/Algorithm/DepthFirstSearch_impl.hpp:36:29: error: ‘find_if’ is not a member of ‘std’; did you mean ‘find’?
36 | auto start_node_it = std::find_if(
| ^~~~~~~
| find
In file included from include/CXXGraph/Graph/Graph.h:33:
include/CXXGraph/Graph/Algorithm/Dial_impl.hpp: In member function ‘virtual const CXXGraph::DialResult CXXGraph::Graph::dial(const CXXGraph::Node&, int) const’:
include/CXXGraph/Graph/Algorithm/Dial_impl.hpp:36:30: error: ‘find_if’ is not a member of ‘std’; did you mean ‘find’?
36 | auto source_node_it = std::find_if(
| ^~~~~~~
| find
include/CXXGraph/Graph/Algorithm/Dial_impl.hpp:112:23: error: ‘find_if’ is not a member of ‘std’; did you mean ‘find’?
112 | auto u_i = std::find_if(
| ^~~~~~~
| find
include/CXXGraph/Graph/Algorithm/Dial_impl.hpp:119:23: error: ‘find_if’ is not a member of ‘std’; did you mean ‘find’?
119 | auto v_i = std::find_if(
| ^~~~~~~
| find
In file included from include/CXXGraph/Graph/Graph.h:34:
include/CXXGraph/Graph/Algorithm/Dijkstra_impl.hpp: In member function ‘virtual const CXXGraph::DijkstraResult CXXGraph::Graph::dijkstra(const CXXGraph::Node&, const CXXGraph::Node&) const’:
include/CXXGraph/Graph/Algorithm/Dijkstra_impl.hpp:34:30: error: ‘find_if’ is not a member of ‘std’; did you mean ‘find’?
34 | auto source_node_it = std::find_if(
| ^~~~~~~
| find
include/CXXGraph/Graph/Algorithm/Dijkstra_impl.hpp:43:30: error: ‘find_if’ is not a member of ‘std’; did you mean ‘find’?
43 | auto target_node_it = std::find_if(
| ^~~~~~~
| find
include/CXXGraph/Graph/Algorithm/Dijkstra_impl.hpp:145:10: error: ‘reverse’ is not a member of ‘std’
145 | std::reverse(result.path.begin(), result.path.end());
| ^~~~~~~
In file included from include/CXXGraph/Graph/Graph.h:36:
include/CXXGraph/Graph/Algorithm/FordFulkerson_impl.hpp: In member function ‘virtual double CXXGraph::Graph::fordFulkersonMaxFlow(const CXXGraph::Node&, const CXXGraph::Node&) const’:
include/CXXGraph/Graph/Algorithm/FordFulkerson_impl.hpp:61:32: error: ‘find_if’ is not a member of ‘std’; did you mean ‘find’?
61 | auto source_node_ptr = *std::find_if(
| ^~~~~~~
| find
include/CXXGraph/Graph/Algorithm/FordFulkerson_impl.hpp:64:32: error: ‘find_if’ is not a member of ‘std’; did you mean ‘find’?
64 | auto target_node_ptr = std::find_if(
| ^~~~~~~
| find
include/CXXGraph/Graph/Algorithm/FordFulkerson_impl.hpp: In lambda function:
include/CXXGraph/Graph/Algorithm/FordFulkerson_impl.hpp:72:16: error: ‘source_node_ptr’ is not captured
72 | queue.push(source_node_ptr);
| ^~~~~~~~~~~~~~~
include/CXXGraph/Graph/Algorithm/FordFulkerson_impl.hpp:69:32: note: the lambda has no capture-default
69 | &weightMap]() -> bool {
| ^
include/CXXGraph/Graph/Algorithm/FordFulkerson_impl.hpp:61:8: note: ‘source_node_ptr’ declared here
61 | auto source_node_ptr = std::find_if(
| ^~~~~~~~~~~~~~~
include/CXXGraph/Graph/Algorithm/FordFulkerson_impl.hpp:73:13: error: ‘source_node_ptr’ is not captured
73 | visited[source_node_ptr] = true;
| ^~~~~~~~~~~~~~~
include/CXXGraph/Graph/Algorithm/FordFulkerson_impl.hpp:69:32: note: the lambda has no capture-default
69 | &weightMap]() -> bool {
| ^
include/CXXGraph/Graph/Algorithm/FordFulkerson_impl.hpp:61:8: note: ‘source_node_ptr’ declared here
61 | auto source_node_ptr = std::find_if(
| ^~~~~~~~~~~~~~~
include/CXXGraph/Graph/Algorithm/FordFulkerson_impl.hpp:74:12: error: ‘source_node_ptr’ is not captured
74 | parent[source_node_ptr] = nullptr;
| ^~~~~~~~~~~~~~~
include/CXXGraph/Graph/Algorithm/FordFulkerson_impl.hpp:69:32: note: the lambda has no capture-default
69 | &weightMap]() -> bool {
| ^
include/CXXGraph/Graph/Algorithm/FordFulkerson_impl.hpp:61:8: note: ‘source_node_ptr’ declared here
61 | auto source_node_ptr = std::find_if(
| ^~~~~~~~~~~~~~~
include/CXXGraph/Graph/Algorithm/FordFulkerson_impl.hpp:87:21: error: ‘target_node_ptr’ is not captured
87 | return (visited[target_node_ptr]);
| ^~~~~~~~~~~~~~~
include/CXXGraph/Graph/Algorithm/FordFulkerson_impl.hpp:69:32: note: the lambda has no capture-default
69 | &weightMap]() -> bool {
| ^
include/CXXGraph/Graph/Algorithm/FordFulkerson_impl.hpp:64:8: note: ‘target_node_ptr’ declared here
64 | auto target_node_ptr = std::find_if(
| ^~~~~~~~~~~~~~~
In file included from include/CXXGraph/Graph/Graph.h:42:
include/CXXGraph/Graph/Algorithm/TopologicalSort_impl.hpp: In member function ‘virtual CXXGraph::TopoSortResult CXXGraph::Graph::topologicalSort() const’:
include/CXXGraph/Graph/Algorithm/TopologicalSort_impl.hpp:71:10: error: ‘reverse’ is not a member of ‘std’
71 | std::reverse(result.nodesInTopoOrder.begin(),
| ^~~~~~~
In file included from include/CXXGraph/Graph/Graph.h:47:
include/CXXGraph/Graph/IO/InputOperation_impl.hpp: In member function ‘int CXXGraph::Graph::readFromDot(const std::string&, const std::string&)’:
include/CXXGraph/Graph/IO/InputOperation_impl.hpp:310:42: error: cannot convert ‘std::__cxx11::basic_string::iterator’ to ‘const char

310 | node2.erase(std::remove(node2.begin(), node2.end(), ' '), node2.end());
| ~~~~~~~~~~~^~
| |
| std::__cxx11::basic_string::iterator
In file included from /usr/include/c++/14/cstdio:42,
from /usr/include/c++/14/ext/string_conversions.h:45,
from /usr/include/c++/14/bits/basic_string.h:4154,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/bits/unique_ptr.h:43,
from /usr/include/c++/14/memory:78,
from test_package.cpp:1:
/usr/include/stdio.h:158:32: note: initializing argument 1 of ‘int remove(const char
)’
158 | extern int remove (const char __filename) __THROW;
| ~~~~~~~~~~~~^~~~~~~~~~
include/CXXGraph/Graph/IO/InputOperation_impl.hpp:311:42: error: cannot convert ‘std::__cxx11::basic_string::iterator’ to ‘const char

311 | node2.erase(std::remove(node2.begin(), node2.end(), '\t'), node2.end());
| ~~~~~~~~~~~^~
| |
| std::__cxx11::basic_string::iterator
/usr/include/stdio.h:158:32: note: initializing argument 1 of ‘int remove(const char
)’
158 | extern int remove (const char __filename) __THROW;
| ~~~~~~~~~~~~^~~~~~~~~~
include/CXXGraph/Graph/IO/InputOperation_impl.hpp:317:44: error: cannot convert ‘std::__cxx11::basic_string::iterator’ to ‘const char

317 | weight.erase(std::remove(weight.begin(), weight.end(), ' '),
| ~~~~~~~~~~~~^~
| |
| std::__cxx11::basic_string::iterator
/usr/include/stdio.h:158:32: note: initializing argument 1 of ‘int remove(const char)’
158 | extern int remove (const char __filename) __THROW;
| ~~~~~~~~~~~~^~~~~~~~~~
In file included from include/CXXGraph/Graph/Graph.h:48:
include/CXXGraph/Graph/IO/OutputOperation_impl.hpp: In member function ‘virtual int CXXGraph::Graph::writeToMTXFile(const std::string&, const std::string&, char) const’:
include/CXXGraph/Graph/IO/OutputOperation_impl.hpp:161:26: error: ‘any_of’ is not a member of ‘std’
161 | bool symmetric = !std::any_of(edgeSet.begin(), edgeSet.end(), [](auto edge) {
| ^~~~~~
In file included from include/CXXGraph/Graph/Graph.h:40:
include/CXXGraph/Graph/Algorithm/Prim_impl.hpp: In instantiation of ‘const CXXGraph::MstResult CXXGraph::Graph::prim() const [with T = int; CXXGraph::MstResult = CXXGraph::MstResult_struct]’:
include/CXXGraph/Graph/Algorithm/Prim_impl.hpp:30:17: required from here
include/CXXGraph/Graph/IO/OutputOperation_impl.hpp:161:26: error: 30 | const MstResult Graph::prim() const {
include/CXXGraph/Graph/IO/OutputOperation_impl.hpp:161:26: error: | ^~~~~~~~
include/CXXGraph/Graph/Algorithm/Prim_impl.hpp:75:18: error: no matching function for call to ‘find(std::vector::iterator, std::vector::iterator, long unsigned int&)’
75 | if (std::find(doneNode.begin(), doneNode.end(), nodeId) == doneNode.end()) {
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
from /usr/include/c++/14/bits/basic_ios.h:37,
from /usr/include/c++/14/ios:46:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: ‘template typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, const _CharT2&)’
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
include/CXXGraph/Graph/Algorithm/Prim_impl.hpp:75:18: note: ‘__gnu_cxx::__normal_iterator<long unsigned int
, std::vector >’ is not derived from ‘std::istreambuf_iterator<_CharT, std::char_traits<_CharT> >’
75 | if (std::find(doneNode.begin(), doneNode.end(), nodeId) == doneNode.end()) {
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/CXXGraph/Graph/Algorithm/Prim_impl.hpp:94:25: error: no matching function for call to ‘find(std::vector::iterator, std::vector::iterator, const CXXGraph::id_t&)’
94 | (std::find(doneNode.begin(), doneNode.end(),
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
95 | elem.first->getId()) == doneNode.end())) {
| ~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: ‘template typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, const _CharT2&)’
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
include/CXXGraph/Graph/Algorithm/Prim_impl.hpp:94:25: note: ‘__gnu_cxx::__normal_iterator<long unsigned int, std::vector >’ is not derived from ‘std::istreambuf_iterator<_CharT, std::char_traits<_CharT> >’
94 | (std::find(doneNode.begin(), doneNode.end(),
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
95 | elem.first->getId()) == doneNode.end())) {
| ~~~~~~~~~~~~~~~~~~~~
include/CXXGraph/Graph/Algorithm/BestFirstSearch_impl.hpp: In instantiation of ‘CXXGraph::BestFirstSearchResult CXXGraph::Graph::best_first_search(const CXXGraph::Node&, const CXXGraph::Node&) const [with T = int; CXXGraph::BestFirstSearchResult = CXXGraph::BestFirstSearchResult_struct]’:
include/CXXGraph/Graph/Algorithm/BestFirstSearch_impl.hpp:34:26: required from here
include/CXXGraph/Graph/Algorithm/Prim_impl.hpp:94:25: note: 34 | BestFirstSearchResult Graph::best_first_search(
include/CXXGraph/Graph/Algorithm/Prim_impl.hpp:94:25: note: | ^~~~~~~~
include/CXXGraph/Graph/Algorithm/BestFirstSearch_impl.hpp:77:26: error: no matching function for call to ‘find(std::vector<CXXGraph::Node, std::allocator<CXXGraph::Node > >::iterator, std::vector<CXXGraph::Node, std::allocator<CXXGraph::Node > >::iterator, std::__shared_ptr_access<const CXXGraph::Node, __gnu_cxx::_S_atomic, false, false>::element_type&)’
77 | if (std::find(visited.begin(), visited.end(), (elem.first)) ==
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: ‘template typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, const _CharT2&)’
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
include/CXXGraph/Graph/Algorithm/BestFirstSearch_impl.hpp:77:26: note: ‘__gnu_cxx::__normal_iterator<CXXGraph::Node
, std::vector<CXXGraph::Node, std::allocator<CXXGraph::Node > > >’ is not derived from ‘std::istreambuf_iterator<_CharT, std::char_traits<_CharT> >’
77 | if (std::find(visited.begin(), visited.end(), *(elem.first)) ==
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/CXXGraph/Graph/Algorithm/BestFirstSearch_impl.hpp:86:26: error: no matching function for call to ‘find(std::vector<CXXGraph::Node, std::allocator<CXXGraph::Node > >::iterator, std::vector<CXXGraph::Node, std::allocator<CXXGraph::Node > >::iterator, std::__shared_ptr_access<const CXXGraph::Node, __gnu_cxx::_S_atomic, false, false>::element_type&)’
86 | if (std::find(visited.begin(), visited.end(), (elem.first)) ==
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: ‘template typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, const _CharT2&)’
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
include/CXXGraph/Graph/Algorithm/BestFirstSearch_impl.hpp:86:26: note: ‘__gnu_cxx::__normal_iterator<CXXGraph::Node
, std::vector<CXXGraph::Node, std::allocator<CXXGraph::Node > > >’ is not derived from ‘std::istreambuf_iterator<_CharT, std::char_traits<_CharT> >’
86 | if (std::find(visited.begin(), visited.end(), *(elem.first)) ==
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/CXXGraph/Graph/Algorithm/BreadthFirstSearch_impl.hpp: In instantiation of ‘const std::vector<CXXGraph::Node > CXXGraph::Graph::breadth_first_search(const CXXGraph::Node&) const [with T = int]’:
include/CXXGraph/Graph/Algorithm/BreadthFirstSearch_impl.hpp:30:28: required from here
include/CXXGraph/Graph/Algorithm/BestFirstSearch_impl.hpp:86:26: note: 30 | const std::vector<Node> Graph::breadth_first_search(
include/CXXGraph/Graph/Algorithm/BestFirstSearch_impl.hpp:86:26: note: | ^~~~~~~~
include/CXXGraph/Graph/Algorithm/BreadthFirstSearch_impl.hpp:55:22: error: no matching function for call to ‘find(std::vector<CXXGraph::Node, std::allocator<CXXGraph::Node > >::iterator, std::vector<CXXGraph::Node, std::allocator<CXXGraph::Node > >::iterator, std::__shared_ptr_access<const CXXGraph::Node, __gnu_cxx::_S_atomic, false, false>::element_type&)’
55 | if (std::find(visited.begin(), visited.end(), (elem.first)) ==
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: ‘template typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, const _CharT2&)’
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
include/CXXGraph/Graph/Algorithm/BreadthFirstSearch_impl.hpp:55:22: note: ‘__gnu_cxx::__normal_iterator<CXXGraph::Node
, std::vector<CXXGraph::Node, std::allocator<CXXGraph::Node > > >’ is not derived from ‘std::istreambuf_iterator<_CharT, std::char_traits<_CharT> >’
55 | if (std::find(visited.begin(), visited.end(), *(elem.first)) ==
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/CXXGraph/Graph/Algorithm/DepthFirstSearch_impl.hpp: In instantiation of ‘const std::vector<CXXGraph::Node > CXXGraph::Graph::depth_first_search(const CXXGraph::Node&) const [with T = int]’:
include/CXXGraph/Graph/Algorithm/DepthFirstSearch_impl.hpp:30:28: required from here
include/CXXGraph/Graph/Algorithm/BreadthFirstSearch_impl.hpp:55:22: note: 30 | const std::vector<Node> Graph::depth_first_search(
include/CXXGraph/Graph/Algorithm/BreadthFirstSearch_impl.hpp:55:22: note: | ^~~~~~~~
include/CXXGraph/Graph/Algorithm/DepthFirstSearch_impl.hpp:51:22: error: no matching function for call to ‘find(std::vector<CXXGraph::Node, std::allocator<CXXGraph::Node > >::iterator, std::vector<CXXGraph::Node, std::allocator<CXXGraph::Node > >::iterator, std::__shared_ptr_access<const CXXGraph::Node, __gnu_cxx::_S_atomic, false, false>::element_type&)’
51 | if (std::find(visited.begin(), visited.end(), (x.first)) ==
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: ‘template typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, const _CharT2&)’
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
include/CXXGraph/Graph/Algorithm/DepthFirstSearch_impl.hpp:51:22: note: ‘__gnu_cxx::__normal_iterator<CXXGraph::Node
, std::vector<CXXGraph::Node, std::allocator<CXXGraph::Node > > >’ is not derived from ‘std::istreambuf_iterator<_CharT, std::char_traits<_CharT> >’
51 | if (std::find(visited.begin(), visited.end(), (x.first)) ==
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/CXXGraph/Graph/Algorithm/Dial_impl.hpp: In instantiation of ‘const CXXGraph::DialResult CXXGraph::Graph::dial(const CXXGraph::Node&, int) const [with T = int; CXXGraph::DialResult = CXXGraph::DialResult_struct]’:
include/CXXGraph/Graph/Algorithm/Dial_impl.hpp:30:18: required from here
include/CXXGraph/Graph/Algorithm/DepthFirstSearch_impl.hpp:51:22: note: 30 | const DialResult Graph::dial(const Node &source, int maxWeight) const {
include/CXXGraph/Graph/Algorithm/DepthFirstSearch_impl.hpp:51:22: note: | ^~~~~~~~
include/CXXGraph/Graph/Algorithm/Dial_impl.hpp:134:36: error: no matching function for call to ‘find(std::deque<std::shared_ptr<const CXXGraph::Node >, std::allocator<std::shared_ptr<const CXXGraph::Node > > >::iterator, std::deque<std::shared_ptr<const CXXGraph::Node >, std::allocator<std::shared_ptr<const CXXGraph::Node > > >::iterator, std::shared_ptr<const CXXGraph::Node >&)’
134 | auto findIter = std::find(B[dv].begin(), B[dv].end(), dist[v].second);
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: ‘template typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, const _CharT2&)’
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
include/CXXGraph/Graph/Algorithm/Dial_impl.hpp:134:36: note: ‘std::_Deque_iterator<std::shared_ptr<const CXXGraph::Node >, std::shared_ptr<const CXXGraph::Node >&, std::shared_ptr<const CXXGraph::Node >
>’ is not derived from ‘std::istreambuf_iterator<_CharT, std::char_traits<_CharT> >’
134 | auto findIter = std::find(B[dv].begin(), B[dv].end(), dist[v].second);
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@@ -35,6 +35,7 @@
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <algorithm>
Copy link
Owner

@ZigRazor ZigRazor May 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why introduce <algorithm> in Graph_decl.h? Maybe is better introduce it when it is needed

@ZigRazor ZigRazor requested review from sbaldu and nolankramer May 6, 2024 06:17
@ZigRazor ZigRazor added the enhancement New feature or request label May 6, 2024
Copy link
Collaborator

@nolankramer nolankramer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please only #include <algorithm> in the *_impl.hpp files where it is needed.

@toge
Copy link
Contributor Author

toge commented May 12, 2024

@ZigRazor @nolankramer
I update this PR to include only on *_impl.hpp.
Could you review it again?

Copy link
Owner

@ZigRazor ZigRazor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good! thank you

Copy link

codecov bot commented May 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.87%. Comparing base (1b31e63) to head (58a20a4).
Report is 25 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #428      +/-   ##
==========================================
+ Coverage   97.58%   97.87%   +0.28%     
==========================================
  Files          87       87              
  Lines        9492    10057     +565     
  Branches        0      666     +666     
==========================================
+ Hits         9263     9843     +580     
+ Misses        229      214      -15     
Flag Coverage Δ
unittests 97.87% <ø> (+0.28%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ZigRazor ZigRazor removed the request for review from sbaldu June 20, 2024 09:35
@ZigRazor ZigRazor merged commit 28cf002 into ZigRazor:master Jun 20, 2024
27 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants