[BGL] VertexProperties as a Nested Type
Dear all, What is my chance to get VertexProperties back in adjacency_list<OutEdgeList, VertexList, Directed, VertexProperties, EdgeProperties, GraphProperties, EdgeList> as a nested type? So, for example: typedef adjacency_list<vecS, vecS, directedS, string> graph_type; where VertexProperties == string. What nested type can I use to get to string from graph_type? It would have made a lot of sense for example if the following piece of code worked: typedef graph_traits<graph_type>::vertex_type my_type; and, as a result, my_type == string. Is a similar thing possible? TIA, --Hossein
On Wed, 19 May 2010, Hossein Haeri wrote:
Dear all,
What is my chance to get VertexProperties back in
adjacency_list<OutEdgeList, VertexList, Directed, VertexProperties, EdgeProperties, GraphProperties, EdgeList>
as a nested type? So, for example:
typedef adjacency_list<vecS, vecS, directedS, string> graph_type;
where VertexProperties == string. What nested type can I use to get to string from graph_type? It would have made a lot of sense for example if the following piece of code worked:
typedef graph_traits<graph_type>::vertex_type my_type;
It looks like there are typedefs graph_type::vertex_property_type and graph_type::edge_property_type in adjacency_list. They appear to be meant to be public, but I am not sure. See if those match what you are expecting. -- Jeremiah Willcock
Dear Jeremiah, Let me first say that I updated my GCC to 4.4.0.
It looks like there are typedefs graph_type::vertex_property_type and graph_type::edge_property_type in adjacency_list.
I guess vertex_property_type is deemed to be what I'm looking for. But, it apparently is not implemented in the way it should have been. I say this because when I compile the following funny code: typedef adjacency_list<vecS, vecS, directedS, string> graph_type; graph_type::vertex_property_type temp1, temp2; string str1(temp1); I receive the following error message: main.cpp:82: error: no matching function for call to 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(boost::property<boost::vertex_bundle_t, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::no_property>&)' ../lib/gcc/mingw32/4.4.0/include/c++/bits/basic_string.tcc:220: note: candidates are: std::basic_string<_CharT, _Traits, _Alloc>::basic_string(typename _Alloc::rebind<_CharT>::other::size_type, _CharT, const _Alloc&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>] ../lib/gcc/mingw32/4.4.0/include/c++/bits/basic_string.tcc:213: note: std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>] ../lib/gcc/mingw32/4.4.0/include/c++/bits/basic_string.tcc:206: note: std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, typename _Alloc::rebind<_CharT>::other::size_type, const _Alloc&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>] ../lib/gcc/mingw32/4.4.0/include/c++/bits/basic_string.tcc:194: note: std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::basic_string<_CharT, _Traits, _Alloc>&, typename _Alloc::rebind<_CharT>::other::size_type, typename _Alloc::rebind<_CharT>::other::size_type, const _Alloc&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>] ../lib/gcc/mingw32/4.4.0/include/c++/bits/basic_string.tcc:184: note: std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::basic_string<_CharT, _Traits, _Alloc>&, typename _Alloc::rebind<_CharT>::other::size_type, typename _Alloc::rebind<_CharT>::other::size_type) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>] ../lib/gcc/mingw32/4.4.0/include/c++/bits/basic_string.tcc:170: note: std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>] ../lib/gcc/mingw32/4.4.0/include/c++/bits/basic_string.tcc:178: note: std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Alloc&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>] ../lib/gcc/mingw32/4.4.0/include/c++/bits/basic_string.h:2147: note: std::basic_string<_CharT, _Traits, _Alloc>::basic_string() [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>] I even checked the typeid's for equality and typeid(graph_type::vertex_property_type) != typeid(string)! More strangely, I get the following error message when I compile "temp1 == temp2": main.cpp:83: error: no match for 'operator==' in 'temp1 == temp2' I'm wondering if this is a bug in GCC 4.4.0? Or, is it because vertex_property_type is not equality comparable?
They appear to be meant to be public, but I am not sure.
Not sure if I understand this English. But, it wasn't easy to find anything about vertex_property_type. Testimony to this is that the only BGL documentation page that Google finds vertex_property_type in is: http://www.boost.org/doc/libs/1_43_0/libs/graph/doc/graph_concepts.html TIA, --Hossein
On Wed, 19 May 2010, Hossein Haeri wrote:
Dear Jeremiah,
Let me first say that I updated my GCC to 4.4.0.
It looks like there are typedefs graph_type::vertex_property_type and graph_type::edge_property_type in adjacency_list.
I guess vertex_property_type is deemed to be what I'm looking for. But, it apparently is not implemented in the way it should have been. I say this because when I compile the following funny code:
typedef adjacency_list<vecS, vecS, directedS, string> graph_type; graph_type::vertex_property_type temp1, temp2; string str1(temp1);
In that case, try: property<graph_type, vertex_bundle_t>::type as your vertex property type (and the same for edge_bundle_t). -- Jeremiah Willcock
Jeremiah,
property<graph_type, vertex_bundle_t>::type
property_map<graph_type, vertex_bundle_t>::type temp1; string str1(temp1); give me the following error message: main.cpp:71: error: 'type' is not a member of 'boost::property<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::no_property, boost::no_property, boost::listS>, boost::vertex_bundle_t, boost::no_property>' And, replacing "property" above with "property_map", I get the following error: main.cpp:72: error: no matching function for call to 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(boost::vec_adj_list_vertex_property_map<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::no_property, boost::no_property, boost::listS>, boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::no_property, boost::no_property, boost::listS>*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, boost::vertex_bundle_t>&)' Any ideas? TIA, --Hossein
On Wed, 19 May 2010, Hossein Haeri wrote:
Jeremiah,
property<graph_type, vertex_bundle_t>::type
property_map<graph_type, vertex_bundle_t>::type temp1; string str1(temp1);
give me the following error message:
main.cpp:71: error: 'type' is not a member of 'boost::property<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::no_property, boost::no_property, boost::listS>, boost::vertex_bundle_t, boost::no_property>'
And, replacing "property" above with "property_map", I get the following error:
main.cpp:72: error: no matching function for call to 'std::basic_string<char, std::char_traits<char>, std::allocator<char>
::basic_string(boost::vec_adj_list_vertex_property_map<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::no_property, boost::no_property, boost::listS>, boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::no_property, boost::no_property, boost::listS>*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, boost::vertex_bundle_t>&)'
Any ideas?
It looks like property_map is the right name. Could you please post the entire file so I know which line numbers those errors are referring to? -- Jeremiah Willcock
participants (2)
-
Hossein Haeri
-
Jeremiah Willcock