CPP/Boost/BGL/GridGraphVertexIterator

From ProgrammingExamples
< CPP
Revision as of 17:01, 25 January 2012 by Daviddoria (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

GridGraphVertexIterator.cpp

#include <iostream>
#include <boost/array.hpp>
#include <boost/graph/grid_graph.hpp>
 
int main(int argc, char* argv[]) 
{
  typedef boost::grid_graph<2> Graph;
 
  boost::array<std::size_t, 2> lengths = { { 5,5 } };
  Graph graph(lengths);
  boost::graph_traits<Graph>::vertex_iterator iterator = vertices(graph); // Compiler error - can't convert iterator to this iterator type
}

CMakeLists.txt

cmake_minimum_required(VERSION 2.6)
 
Project(GridGraphVertexIterator)
 
set(Boost_USE_MULTITHREADED ON)
FIND_PACKAGE(Boost 1.38 COMPONENTS)
 
INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES} ${Boost_INCLUDE_DIRS})
LINK_DIRECTORIES(${LINK_DIRECTORIES} ${Boost_LIBRARY_DIRS})
 
ADD_EXECUTABLE(GridGraphVertexIterator GridGraphVertexIterator.cpp)