Boost logo

Boost Users :

Subject: [Boost-users] BGL: boost::astar_search_no_init
From: Georg Gast (georg_at_[hidden])
Date: 2014-08-24 02:58:55


Hi there!

Currently i try to implement an astar search with BGL and boost. My
graph is infinite, so i searched for an example of
astar_search_no_init and found this:

http://lists.boost.org/boost-users/2012/03/73707.php

I am on gcc-4.9.0 and boost 1.52.0 on linux.

I try to compile the above example and get the following error which i
cant decipher ...

make
gcc -std=c++11 example.cpp -o example
example.cpp: In function 'int main(int, char**)':
example.cpp:274:140: error: no matching function for call to
'boost::associative_property_map<default_map<std::pair<XY, XY>, unsigned
int> >::associative_property_map(default_map<std::pair<XY, XY>, unsigned
int>)'
             .
weight_map(boost::associative_property_map<default_map<std::pair<XY,XY>,unsigned>
>(default_map<std::pair<XY,XY>,unsigned>(1)))

I added the code as an attachement.

For me it seems that this line is not ok .... but i currently have no
clue how to fix it ...

    try {
        astar_search_no_init(g,
            start,
            distance_heuristic<XYGraph>(goal)
            , visitor(astar_goal_visitor(goal))
            . distance_map(d)
            . predecessor_map(boost::ref(p))
            .
weight_map(boost::associative_property_map<default_map<std::pair<XY,XY>,unsigned>
>(default_map<std::pair<XY,XY>,unsigned>(1)) // < --- line 274
            .
vertex_index_map(boost::associative_property_map<std::map<XY,unsigned>
>(std::map<XY,unsigned>()))
            .
rank_map(boost::associative_property_map<std::map<XY,unsigned>
>(std::map<XY,unsigned>()))
            .
color_map(boost::associative_property_map<std::map<XY,boost::default_color_type>
>(std::map<XY,boost::default_color_type>()))
            . distance_compare(std::less<unsigned>())
            . distance_combine(std::plus<unsigned>())
            );

with clang 3.4 i get this error line.
 clang --std=c++11 example.cpp -o ex
example.cpp:274:26: error: no matching conversion for functional-style
cast from 'default_map<std::pair<XY, XY>, unsigned int>' to
      'boost::associative_property_map<default_map<std::pair<XY, XY>,
unsigned int> >'
            .
weight_map(boost::associative_property_map<default_map<std::pair<XY,XY>,unsigned>
>(default_map<std::pair<XY,XY>,unsigned>(1))

So what ant the author of this code do? Allocate a property map of size 1?

Currently i dont see the forrest, there are so many trees in my view ....

Any help would be appreciated!

Thank you!
Georg





Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net