Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-09-05 09:49:37


Hi Hankel,

I think this is already fixed in the current snapshot... but don't switch
to the snapshot now, there's a killer VC++ error in the new version of
tie() that needs to get fixed.

The fix is simply to do add this to relax.hpp (I assume that is where the
call to std::abs is causing a problem).

#ifdef BOOST_NO_STDC_NAMESPACE
namespace std { using ::abs; }
#endif

Cheers,
Jeremy

P.S. Next time please include some of the compiler error message.

On Tue, 4 Sep 2001 hankel_o_fung_at_[hidden] wrote:

hankel> The VC namespace bug "abs is not a member of std" showed up
hankel> when I tried the following johnson all-pairs shortest path test.
hankel> I am using VC 6.0 SP5 + boost.graph 1.22.0. Any way to get around
hankel> the problem?
hankel>
hankel> Cheers,
hankel> Hankel
hankel>
hankel> #include <boost/graph/johnson_all_pairs_shortest.hpp>
hankel> #include <boost/graph/adjacency_list.hpp>
hankel> #include <limits>
hankel> #include <iostream>
hankel>
hankel> //#define USE_AN_EARLIER_VERSION
hankel>
hankel> int main()
hankel> {
hankel> using namespace std;
hankel> using namespace boost;
hankel>
hankel> #ifdef USE_AN_EARLIER_VERSION
hankel> // boost.graph 1.21.1 or earlier versions
hankel> typedef adjacency_list<vecS, vecS, directedS, no_property,
hankel> property<edge_weight_t, int> > TMP_GRAPH;
hankel> #else
hankel> // boost.graph 1.21.2 or later versions???
hankel> typedef adjacency_list<vecS, vecS, directedS, no_property,
hankel> property<edge_weight_t, int,
hankel> property<edge_weight2_t, int> > > TMP_GRAPH;
hankel> #endif
hankel>
hankel> int const infinity = numeric_limits<int>::max();
hankel> int const N(4);
hankel>
hankel> TMP_GRAPH tmp(N);
hankel> vector<vector<int> > distance(N, vector<int>(N, infinity));
hankel> property_map<TMP_GRAPH, edge_weight_t>::type w
hankel> = get(edge_weight, tmp);
hankel> vector<int> d(N, infinity);
hankel> vector<int> h(N);
hankel> vector<default_color_type> c(N);
hankel>
hankel> add_edge(0,1,tmp);
hankel> add_edge(1,0,tmp);
hankel> add_edge(0,2,tmp);
hankel> add_edge(3,1,tmp);
hankel>
hankel> // 0 <-> 1
hankel> //
hankel> // | ^
hankel> // v |
hankel> //
hankel> // 2 3
hankel>
hankel> TMP_GRAPH::edge_iterator ei, eend;
hankel> for (tie(ei,eend) = edges(tmp); ei != eend; ++ei)
hankel> put(edge_weight, tmp, *ei, 1);
hankel>
hankel> #ifdef USE_AN_EARLIER_VERSION
hankel> // boost.graph 1.21.1 or earlier versions
hankel> johnson_all_pairs_shortest_paths
hankel> (tmp, distance, d.begin(), h.begin(), w, c.begin(),
hankel> get(vertex_index, tmp));
hankel> #else
hankel> // boost.graph 1.21.2 or later versions???
hankel> johnson_all_pairs_shortest_paths
hankel> (tmp, distance, distance_map(d.begin()));
hankel> #endif
hankel>
hankel> for (int i=0; i<N; ++i)
hankel> {
hankel> for (int j=0; j<N; ++j)
hankel> cout << distance[i][j] << ' ';
hankel> cout << endl;
hankel> }
hankel> cout << endl;
hankel>
hankel> return 0;
hankel> }
hankel>
hankel>
hankel>
hankel> Info: http://www.boost.org Unsubscribe: <mailto:boost-unsubscribe_at_[hidden]>
hankel>
hankel> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
hankel>
hankel>
hankel>

----------------------------------------------------------------------
 Jeremy Siek http://php.indiana.edu/~jsiek/
 Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
 C++ Booster (http://www.boost.org) office phone: (812) 855-9761
----------------------------------------------------------------------


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk