Boost C++ Libraries: Ticket #12: Can't specify VertexPredicate
https://svn.boost.org/trac10/ticket/12
<pre class="wiki">From boost_1_25_1/boost/graph/filtered_graph.hpp, line
230:
template <typename Graph, typename EdgePredicate,
typename VertexPredicate>
inline filtered_graph<Graph, EdgePredicate,
VertexPredicate>
make_filtered_graph(Graph& g, EdgePredicate ep,
VertexPredicate vp) {
return filtered_graph<Graph, EdgePredicate>(g, ep,
vp);
}
make_filtered_graph is a template function, one of
whose template parameters is VertexPredicate. However,
the filtered_graph object returned by the function does
not make use of this type.
I propose that line 233 should read:
return filtered_graph<Graph, EdgePredicate,
VertexPredicate>(g, ep, vp);
I'm using g++ 2.95.3 on Solaris 2.8 for sparc. For the
following test case:
#include <boost/graph/filtered_graph.hpp>
#include <boost/graph/adjacency_list.hpp>
using namespace boost;
struct NotMuchOfAFilter
{
template<class Vertex> bool operator()(Vertex key)
const { return true; }
};
int main()
{
adjacency_list<> graph;
make_filtered_graph(graph, keep_all(),
NotMuchOfAFilter());
}
g++ test.C -ftemplate-depth-30 -Iboost_1_25_1
yields:
boost_1_25_1/boost/graph/filtered_graph.hpp: In
function `class
boost::filtered_graph<boost::adjacency_list<boost::vecS,boost::vecS,boost::directedS,boost::no_property,boost::no_property,boost::no_property,boost::listS>,boost::keep_all,NotMuchOfAFilter>
boost::make_filtered_graph<boost::adjacency_list<boost::vecS,boost::vecS,boost::directedS,boost::no_property,boost::no_property,boost::no_property,boost::listS>,
boost::keep_all,
NotMuchOfAFilter>(boost::adjacency_list<boost::vecS,boost::vecS,boost::directedS,boost::no_property,boost::no_property,boost::no_property,boost::listS>
&, boost::keep_all, NotMuchOfAFilter)':
test.C:14: instantiated from here
boost_1_25_1/boost/graph/filtered_graph.hpp:233: no
matching function for call to
`boost::filtered_graph<boost::adjacency_list<boost::vecS,boost::vecS,boost::directedS,boost::no_property,boost::no_property,boost::no_property,boost::listS>,boost::keep_all,boost::keep_all>::filtered_graph
(boost::adjacency_list<boost::vecS,boost::vecS,boost::directedS,boost::no_property,boost::no_property,boost::no_property,boost::listS>
&, boost::keep_all &, NotMuchOfAFilter &)'
boost_1_25_1/boost/graph/filtered_graph.hpp:156:
candidates are:
boost::filtered_graph<boost::adjacency_list<boost::vecS,boost::vecS,boost::directedS,boost::no_property,boost::no_property,boost::no_property,boost::listS>,boost::keep_all,boost::keep_all>::filtered_graph(const
boost::adjacency_list<boost::vecS,boost::vecS,boost::directedS,boost::no_property,boost::no_property,boost::no_property,boost::listS>
&, boost::keep_all)
boost_1_25_1/boost/graph/filtered_graph.hpp:159:
boost::filtered_graph<boost::adjacency_list<boost::vecS,boost::vecS,boost::directedS,boost::no_property,boost::no_property,boost::no_property,boost::listS>,boost::keep_all,boost::keep_all>::filtered_graph(const
boost::adjacency_list<boost::vecS,boost::vecS,boost::directedS,boost::no_property,boost::no_property,boost::no_property,boost::listS>
&, boost::keep_all, boost::keep_all)
boost_1_25_1/boost/graph/filtered_graph.hpp:219:
boost::filtered_graph<boost::adjacency_list<boost::vecS,boost::vecS,boost::directedS,boost::no_property,boost::no_property,boost::no_property,boost::listS>,boost::keep_all,boost::keep_all>::filtered_graph(const
boost::filtered_graph<boost::adjacency_list<boost::vecS,boost::vecS,boost::directedS,boost::no_property,boost::no_property,boost::no_property,boost::listS>,boost::keep_all,boost::keep_all>
&)
boost_1_25_1/boost/graph/filtered_graph.hpp:233:
warning: control reaches end of non-void function
`boost::make_filtered_graph<boost::adjacency_list<boost::vecS,boost::vecS,boost::directedS,boost::no_property,boost::no_property,boost::no_property,boost::listS>,
boost::keep_all,
NotMuchOfAFilter>(boost::adjacency_list<boost::vecS,boost::vecS,boost::directedS,boost::no_property,boost::no_property,boost::no_property,boost::listS>
&, boost::keep_all, NotMuchOfAFilter)
Making the change I noted above causes the code to
compile and run correctly.
Keep up the good work on boost and the boost graph
library. Congratulations on the new book!
</pre>en-usBoost C++ Libraries/htdocs/site/boost.png
https://svn.boost.org/trac10/ticket/12
Trac 1.4.3jsiekFri, 09 Nov 2001 20:58:12 GMTstatus changed
https://svn.boost.org/trac10/ticket/12#comment:1
https://svn.boost.org/trac10/ticket/12#comment:1
<ul>
<li><strong>status</strong>
<span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span>
</li>
</ul>
<pre class="wiki">Logged In: YES
user_id=32836
Thanks for catching that! I've checked your suggested
fix into CVS.
</pre>
Ticket