Boost logo

Boost :

From: John Britton (johnb_at_[hidden])
Date: 2000-10-06 10:04:27


> I don't think it's legal to put the main() function in a namespace. Or
> rather, it is legal, but then it's not the main() function. See clause
> 3.6.1 in the Standard (excerpts below):

Lois,
The namespace is a red herring (sorry) - I was just attempting to find the
simplest way to demonstrate the same error that I'm getting buried deep in
my own source code. There are other ways to excite the error, and you may be
on to something with white-space confusing VC++ - in the following code
cause the fatal compiler error, but this can be fixed by uncommenting the
noted preprocessor directives! I'm going to play with the white-space now
and see what I can determine.
JohnB

/*====
msbug.cpp
Code demonstrating a VC++ compiler problem
====*/
#pragma warning (disable: 4786)
#include <vector>
#include <utility>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/connected_components.hpp>

typedef std::pair<int, int> edge_t;
typedef std::vector< edge_t > edge_list_t;

size_t check_components( int num_vertices, edge_list_t& the_edges ) {
//#if 1 // uncomment to fix bug
  // create graph based on the_edges
  boost::adjacency_list<
    boost::vecS, boost::vecS, boost::undirectedS,
    boost::property<
      boost::vertex_discover_time_t, int,
      boost::property<
        boost::vertex_finish_time_t, int,
        boost::property<
          boost::vertex_color_t, boost::default_color_type > > > >
  G( num_vertices, the_edges.begin(), the_edges.end() );
//#endif // uncomment to fix bug
  // result data: component ID for each vertex
  std::vector<int> c( boost::num_vertices(G) );
  //
  int num = boost::connected_components(
    G, &c[0], boost::get( boost::vertex_color, G ), boost::dfs_visitor<>()
  );
  return num;
}


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