Boost logo

Boost :

From: John Britton (johnb_at_[hidden])
Date: 2000-11-02 13:52:57


I found that one version of boost::get fails compile (under VC++), while
another, allegedly equivalent, version does not.

#pragma warning (disable: 4786)
#include <boost/graph/adjacency_list.hpp>

/*==== foo */
void foo() {
  //---- create undirected graph, with edge_index property
  typedef boost::adjacency_list<
    boost::vecS, boost::vecS, boost::undirectedS,
    boost::property< boost::vertex_color_t, boost::default_color_type >,
    boost::property< boost::edge_index_t, size_t >
> graph_t;
  graph_t g( 3 );
  boost::add_edge( 0, 1, 0, g );
  boost::add_edge( 1, 2, 0, g );

  //---- get index of the first edge
#if 1
  // THIS STATEMENT FAILS VC++ COMPILE WITH "property_map.hpp(283) : error
C2678..."
  boost::get( boost::edge_index, g, *boost::edges( g ).first );
#else
  // THIS STATEMENT DOES NOT FAIL COMPILE
  boost::get( boost::edge_index, g )[ *boost::edges( g ).first ];
#endif

}

John Britton
Very Important Engineer++
Peak Audio Inc.
1790 30th Street, Suite 414
Boulder, CO 80301
303.449.9337 x102
johnb_at_[hidden]
http://www.peakaudio.com/


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