[BGL]: adjacency_list_io bug?

Hello everybody! I'm using adjacency_list_io to import my graphs from the disk: typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS > graph_t; graph_t wwwg; //string dataFile("www.bdat"); string dataFile("www_undirected.bdat"); cout << "importing www network from file \"" << dataFile << "\" ... "; ifstream wwwDatIn(dataFile.c_str()); wwwDatIn >> read( wwwg ); wwwDatIn.close(); This works nicely with g++ 3.3, but g++ 4.0 refuse to compile this code and chokes with an error message like /home/sebi/projects/diplom/src/boost_1_33_1/boost/graph/adjacency_list_io.hpp: In member function 'boost::GraphParser<Graph_t, VertexProperty, EdgeProperty, VertexPropertySubset, EdgePropertySubset>& boost::GraphParser<Graph_t, VertexProperty, EdgeProperty, VertexPropertySubset, EdgePropertySubset>::operator()(std::istream&) [with Graph_t = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::no_property, boost::no_property, boost::listS>, VertexProperty = boost::no_property, EdgeProperty = boost::no_property, VertexPropertySubset = boost::no_property, EdgePropertySubset = boost::no_property]': /home/sebi/projects/diplom/src/boost_1_33_1/boost/graph/adjacency_list_io.hpp:327: instantiated from 'std::istream& boost::operator>>(std::istream&, boost::GraphParser<Graph, VP, EP, VPS, EPS>) [with Graph = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::no_property, boost::no_property, boost::listS>, VP = boost::no_property, EP = boost::no_property, VPS = boost::no_property, EPS = boost::no_property]' I have no clue where this comes from, but it seems to be some incompatibility between g++ 4.0 and adjacency_list_io. Would be nice if someone could enlighten me or fix it. Thanks! Sebastian My system: Ubuntu 5.10, Boost 1.33.1, anything else needed?

On 4/10/06, Sebastian Weber <sebastian.weber@physik.tu-darmstadt.de> wrote:
[snip]
This works nicely with g++ 3.3, but g++ 4.0 refuse to compile this code and chokes with an error message like
/home/sebi/projects/diplom/src/boost_1_33_1/boost/graph/adjacency_list_io.hpp: In member function 'boost::GraphParser<Graph_t, VertexProperty, EdgeProperty, VertexPropertySubset, EdgePropertySubset>& boost::GraphParser<Graph_t, VertexProperty, EdgeProperty, VertexPropertySubset, EdgePropertySubset>::operator()(std::istream&) [with Graph_t = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::no_property, boost::no_property, boost::listS>, VertexProperty = boost::no_property, EdgeProperty = boost::no_property, VertexPropertySubset = boost::no_property, EdgePropertySubset = boost::no_property]': /home/sebi/projects/diplom/src/boost_1_33_1/boost/graph/adjacency_list_io.hpp:327: instantiated from 'std::istream& boost::operator>>(std::istream&, boost::GraphParser<Graph, VP, EP, VPS, EPS>) [with Graph = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::no_property, boost::no_property, boost::listS>, VP = boost::no_property, EP = boost::no_property, VPS = boost::no_property, EPS = boost::no_property]'
The error message is missing ! We can't help you if you don't show the whole error messages or your code. -- Johan

Hello!
/home/sebi/projects/diplom/src/boost_1_33_1/boost/graph/adjacency_list_io.hpp: In member function 'boost::GraphParser<Graph_t, VertexProperty, EdgeProperty, VertexPropertySubset, EdgePropertySubset>& boost::GraphParser<Graph_t, VertexProperty, EdgeProperty, VertexPropertySubset, EdgePropertySubset>::operator()(std::istream&) [with Graph_t = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::no_property, boost::no_property, boost::listS>, VertexProperty = boost::no_property, EdgeProperty = boost::no_property, VertexPropertySubset = boost::no_property, EdgePropertySubset = boost::no_property]': /home/sebi/projects/diplom/src/boost_1_33_1/boost/graph/adjacency_list_io.hpp:327: instantiated from 'std::istream& boost::operator>>(std::istream&, boost::GraphParser<Graph, VP, EP, VPS, EPS>) [with Graph = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::no_property, boost::no_property, boost::listS>, VP = boost::no_property, EP = boost::no_property, VPS = boost::no_property, EPS = boost::no_property]'
The error message is missing ! We can't help you if you don't show the whole error messages or your code.
Ok, here is the full output: /home/sebi/projects/diplom/src/boost_1_33_1/boost/graph/adjacency_list_io.hpp: In member function 'boost::GraphParser<Graph_t, VertexProperty, EdgeProperty, VertexPropertySubset, EdgePropertySubset>& boost::GraphParser<Graph_t, VertexProperty, EdgeProperty, VertexPropertySubset, EdgePropertySubset>::operator()(std::istream&) [with Graph_t = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::no_property, boost::no_property, boost::listS>, VertexProperty = boost::no_property, EdgeProperty = boost::no_property, VertexPropertySubset = boost::no_property, EdgePropertySubset = boost::no_property]': /home/sebi/projects/diplom/src/boost_1_33_1/boost/graph/adjacency_list_io.hpp:327: instantiated from 'std::istream& boost::operator>>(std::istream&, boost::GraphParser<Graph, VP, EP, VPS, EPS>) [with Graph = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::no_property, boost::no_property, boost::listS>, VP = boost::no_property, EP = boost::no_property, VPS = boost::no_property, EPS = boost::no_property]' boxTest.cpp:103: instantiated from here /home/sebi/projects/diplom/src/boost_1_33_1/boost/graph/adjacency_list_io.hpp:151: error: 'boost::GraphParser<Graph_t, VertexProperty, EdgeProperty, VertexPropertySubset, EdgePropertySubset>::operator()(std::istream&) [with Graph_t = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::no_property, boost::no_property, boost::listS>, VertexProperty = boost::no_property, EdgeProperty = boost::no_property, VertexPropertySubset = boost::no_property, EdgePropertySubset = boost::no_property]::State' uses local type 'boost::GraphParser<Graph_t, VertexProperty, EdgeProperty, VertexPropertySubset, EdgePropertySubset>::operator()(std::istream&) [with Graph_t = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::no_property, boost::no_property, boost::listS>, VertexProperty = boost::no_property, EdgeProperty = boost::no_property, VertexPropertySubset = boost::no_property, EdgePropertySubset = boost::no_property]::State' /home/sebi/projects/diplom/src/boost_1_33_1/boost/graph/adjacency_list_io.hpp:151: error: trying to instantiate 'template<class T> struct boost::is_integral' /home/sebi/projects/diplom/src/boost_1_33_1/boost/graph/adjacency_list_io.hpp:151: error: 'boost::GraphParser<Graph_t, VertexProperty, EdgeProperty, VertexPropertySubset, EdgePropertySubset>::operator()(std::istream&) [with Graph_t = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::no_property, boost::no_property, boost::listS>, VertexProperty = boost::no_property, EdgeProperty = boost::no_property, VertexPropertySubset = boost::no_property, EdgePropertySubset = boost::no_property]::State' uses local type 'boost::GraphParser<Graph_t, VertexProperty, EdgeProperty, VertexPropertySubset, EdgePropertySubset>::operator()(std::istream&) [with Graph_t = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::no_property, boost::no_property, boost::listS>, VertexProperty = boost::no_property, EdgeProperty = boost::no_property, VertexPropertySubset = boost::no_property, EdgePropertySubset = boost::no_property]::State' /home/sebi/projects/diplom/src/boost_1_33_1/boost/graph/adjacency_list_io.hpp:151: error: trying to instantiate 'template<class T> struct boost::is_integral' /home/sebi/projects/diplom/src/boost_1_33_1/boost/graph/adjacency_list_io.hpp:327: instantiated from 'std::istream& boost::operator>>(std::istream&, boost::GraphParser<Graph, VP, EP, VPS, EPS>) [with Graph = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::no_property, boost::no_property, boost::listS>, VP = boost::no_property, EP = boost::no_property, VPS = boost::no_property, EPS = boost::no_property]' boxTest.cpp:103: instantiated from here /home/sebi/projects/diplom/src/boost_1_33_1/boost/graph/adjacency_list_io.hpp:162: error: 'boost::GraphParser<Graph_t, VertexProperty, EdgeProperty, VertexPropertySubset, EdgePropertySubset>::operator()(std::istream&) [with Graph_t = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::no_property, boost::no_property, boost::listS>, VertexProperty = boost::no_property, EdgeProperty = boost::no_property, VertexPropertySubset = boost::no_property, EdgePropertySubset = boost::no_property]::State' uses local type 'boost::GraphParser<Graph_t, VertexProperty, EdgeProperty, VertexPropertySubset, EdgePropertySubset>::operator()(std::istream&) [with Graph_t = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::no_property, boost::no_property, boost::listS>, VertexProperty = boost::no_property, EdgeProperty = boost::no_property, VertexPropertySubset = boost::no_property, EdgePropertySubset = boost::no_property]::State' /home/sebi/projects/diplom/src/boost_1_33_1/boost/graph/adjacency_list_io.hpp:162: error: trying to instantiate 'template<class T> struct boost::is_integral' /home/sebi/projects/diplom/src/boost_1_33_1/boost/graph/adjacency_list_io.hpp:162: error: 'boost::GraphParser<Graph_t, VertexProperty, EdgeProperty, VertexPropertySubset, EdgePropertySubset>::operator()(std::istream&) [with Graph_t = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::no_property, boost::no_property, boost::listS>, VertexProperty = boost::no_property, EdgeProperty = boost::no_property, VertexPropertySubset = boost::no_property, EdgePropertySubset = boost::no_property]::State' uses local type 'boost::GraphParser<Graph_t, VertexProperty, EdgeProperty, VertexPropertySubset, EdgePropertySubset>::operator()(std::istream&) [with Graph_t = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::no_property, boost::no_property, boost::listS>, VertexProperty = boost::no_property, EdgeProperty = boost::no_property, VertexPropertySubset = boost::no_property, EdgePropertySubset = boost::no_property]::State' /home/sebi/projects/diplom/src/boost_1_33_1/boost/graph/adjacency_list_io.hpp:162: error: trying to instantiate 'template<class T> struct boost::is_integral' "g++-4.0" -Wall -ftemplate-depth-100 -msse2 -mfpmath=sse,387 -O3 -finline-functions -Wno-inline -fPIC -msse2 -mfpmath=sse,387 -DBOOST_DATE_TIME_DYN_LINK=1 -DDATE_TIME_INLINE -DNDEBUG -I"." -I"/home/sebi/projects/diplom/src/boost_1_33_1" -c -o "../../bin/graph/gcc-4.0/release/boxTest.o" "boxTest.cpp" ...failed gcc.compile.c++ ../../bin/graph/gcc-4.0/release/boxTest.o... Sebastian
-- Johan _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Sebastian Weber <sebastian.weber@physik.tu-darmstadt.de> writes:
/home/sebi/projects/diplom/src/boost_1_33_1/boost/graph/adjacency_list_io.hpp:151: error: 'boost::GraphParser<Graph_t, VertexProperty, EdgeProperty, VertexPropertySubset, EdgePropertySubset>::operator()(std::istream&) [with Graph_t = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::no_property, boost::no_property, boost::listS>, VertexProperty = boost::no_property, EdgeProperty = boost::no_property, VertexPropertySubset = boost::no_property, EdgePropertySubset = boost::no_property]::State' uses local type 'boost::GraphParser<Graph_t, VertexProperty, EdgeProperty, VertexPropertySubset, EdgePropertySubset>::operator()(std::istream&) [with Graph_t = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::no_property, boost::no_property, boost::listS>, VertexProperty = boost::no_property, EdgeProperty = boos t::no_property, VertexPropertySubset = boost::no_property, EdgePropertySubset = boost::no_ property]::State'
This says that the GraphParser class -- which you apparently defined in namespace boost; naughty, naughty! -- has an operator() with a locally-defined type State, and you're trying to pass an instance of that type off to a function template. It's a rule of C++ that you can't instantiate templates on function-local types. Learning to read your compiler's error messages can be difficult, but it is well worth the effort. STLFilt can help to make them more approachable (http://www.bdsoft.com) HTH, -- Dave Abrahams Boost Consulting www.boost-consulting.com

Hi!
/home/sebi/projects/diplom/src/boost_1_33_1/boost/graph/adjacency_list_io.hpp:151: error: 'boost::GraphParser<Graph_t, VertexProperty, EdgeProperty, VertexPropertySubset, EdgePropertySubset>::operator()(std::istream&) [with Graph_t = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::no_property, boost::no_property, boost::listS>, VertexProperty = boost::no_property, EdgeProperty = boost::no_property, VertexPropertySubset = boost::no_property, EdgePropertySubset = boost::no_property]::State' uses local type 'boost::GraphParser<Graph_t, VertexProperty, EdgeProperty, VertexPropertySubset, EdgePropertySubset>::operator()(std::istream&) [with Graph_t = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::no_property, boost::no_property, boost::listS>, VertexProperty = boost::no_property, EdgeProperty = boos t::no_property, VertexPropertySubset = boost::no_property, EdgePropertySubset = boost::no_ property]::State'
This says that the GraphParser class -- which you apparently defined in namespace boost; naughty, naughty! -- has an operator() with a
Well, the GraphParser-class is placed in adjacency_list_io within the namespace boost, that wasn't me.
locally-defined type State, and you're trying to pass an instance of that type off to a function template.
It's a rule of C++ that you can't instantiate templates on function-local types.
Oh, as I have learned template-stuff by doing it and not reading a book (which I probably should have), I'm actually not that familiar with this. In short: I don't understand neither the problem nor do I know how to fix it.
Learning to read your compiler's error messages can be difficult, but it is well worth the effort. STLFilt can help to make them more approachable (http://www.bdsoft.com)
Well, I looked there, but STLFilt doesn't support g++ 4.0 (to be exact: g++-4.0 (GCC) 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9)). And gcc-3.3 (and 3.4) DOES compile my code without any complaints. Any other ideas? Sebastian
HTH,

Sebastian Weber <sebastian.weber@physik.tu-darmstadt.de> writes:
Hi!
/home/sebi/projects/diplom/src/boost_1_33_1/boost/graph/adjacency_list_io.hpp:151: error: 'boost::GraphParser<Graph_t, VertexProperty, EdgeProperty, VertexPropertySubset, EdgePropertySubset>::operator()(std::istream&) [with Graph_t = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::no_property, boost::no_property, boost::listS>, VertexProperty = boost::no_property, EdgeProperty = boost::no_property, VertexPropertySubset = boost::no_property, EdgePropertySubset = boost::no_property]::State' uses local type 'boost::GraphParser<Graph_t, VertexProperty, EdgeProperty, VertexPropertySubset, EdgePropertySubset>::operator()(std::istream&) [with Graph_t = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::no_property, boost::no_property, boost::listS>, VertexProperty = boost::no_property, EdgeProperty = boos t::no_property, VertexPropertySubset = boost::no_property, EdgePropertySubset = boost::no_ property]::State'
This says that the GraphParser class -- which you apparently defined in namespace boost; naughty, naughty! -- has an operator() with a
Well, the GraphParser-class is placed in adjacency_list_io within the namespace boost, that wasn't me.
I don't know what you mean. Who was it? I certainly see "boost::GraphParser" in the error message above, so where does adjacency_list_io come into it?
locally-defined type State, and you're trying to pass an instance of that type off to a function template.
It's a rule of C++ that you can't instantiate templates on function-local types.
Oh, as I have learned template-stuff by doing it and not reading a book (which I probably should have), I'm actually not that familiar with this. In short: I don't understand neither the problem nor do I know how to fix it.
Simple: don't define the State type locally to the function. If the type depends on some template parameters of the function, e.g. class State : public foo<VertexProperty> { ... }; you can just define it outside the function as: template <class VertexProperty> class State_ : public foo<VertexProperty> { ... }; and then in the function: typedef State_<VertexProperty> State;
Learning to read your compiler's error messages can be difficult, but it is well worth the effort. STLFilt can help to make them more approachable (http://www.bdsoft.com)
Well, I looked there, but STLFilt doesn't support g++ 4.0 (to be exact: g++-4.0 (GCC) 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9)).
I use STLFilt with g++-4 with success.
And gcc-3.3 (and 3.4) DOES compile my code without any complaints.
Not to be blunt, but so what? That doesn't make your code right.
Any other ideas?
Not really; I told you what the problem was. I hope it helped, because there are no other answers AFAIK. -- Dave Abrahams Boost Consulting www.boost-consulting.com

Hi! It turned out that the enum-definition typedef enum{ PARSE_NUM_NODES, PARSE_VERTEX, PARSE_EDGE } State; which was placed inside the GraphParser::operator() method caused all the trouble. Once I moved that definition outside the function body into the class-defintion, everything worked as it should. I attached the corresponding patch. Would someone please check this and then commit this into cvs boost?
I don't know what you mean. Who was it? I certainly see "boost::GraphParser" in the error message above, so where does adjacency_list_io come into it?
I was just saying that I did not write the code - it was original boost-code.
I use STLFilt with g++-4 with success.
Good to know, the specs on the web-site are then outdated. Thanks, Sebastian
And gcc-3.3 (and 3.4) DOES compile my code without any complaints.
Not to be blunt, but so what? That doesn't make your code right.
Any other ideas?
Not really; I told you what the problem was. I hope it helped, because there are no other answers AFAIK.

On Apr 10, 2006, at 2:28 PM, Sebastian Weber wrote:
Hi!
It turned out that the enum-definition
typedef enum{ PARSE_NUM_NODES, PARSE_VERTEX, PARSE_EDGE } State;
which was placed inside the GraphParser::operator() method caused all the trouble. Once I moved that definition outside the function body into the class-defintion, everything worked as it should. I attached the corresponding patch. Would someone please check this and then commit this into cvs boost?
Thanks for the fix! I've checked it into Boost CVS. Doug

Doug Gregor <dgregor@cs.indiana.edu> writes:
On Apr 10, 2006, at 2:28 PM, Sebastian Weber wrote:
Hi!
It turned out that the enum-definition
typedef enum{ PARSE_NUM_NODES, PARSE_VERTEX, PARSE_EDGE } State;
which was placed inside the GraphParser::operator() method caused all the trouble. Once I moved that definition outside the function body into the class-defintion, everything worked as it should. I attached the corresponding patch. Would someone please check this and then commit this into cvs boost?
Thanks for the fix! I've checked it into Boost CVS.
How does it happen that Boost code is using CamelCase for types? That's what confused me about the original post. -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (4)
-
David Abrahams
-
Doug Gregor
-
Johan Oudinet
-
Sebastian Weber