Issue with boost graph and Unreal

So i added the boost graph (headers only) to my UE 4.4 project and copied the Kevin Bacon example( Kevin Bacon Example - 1.56.0) into my custom game state class and changed how the vertices and edges get populated and I ran into an issue when trying to use breadth_first_search() I get the following error:


Error	2	error C4610: struct 'boost::BFSVisitorConcept<BFSVisitor,IncidenceGraph>' can never be instantiated - user defined constructor required

Everything up to the breadth_first_search call compiles just fine.

If i create a blank VS project and add my code to it it compiles just fine. So my only conclusion is that something with how unreal engine projects get compiled is what is causing the error.

I have everything in a function for testing purposes for now:




template<typename DistanceMap>
class Location_Distance_Recorder : public default_bfs_visitor
{
public:
	Location_Distance_Recorder(DistanceMap dist) : d(dist) { }

	template <typename Edge, typename Graph>
	void non_tree_edge(Edge e, const Graph& g) const
	{
		typename graph_traits<Graph>::vertex_descriptor
		u = source(e, g), v = target(e, g);
		d[v] = d + 1;
	}
private:
	DistanceMap d;
};

template<typename DistanceMap>
Location_Distance_Recorder<DistanceMap>
record_distance_number(DistanceMap d)
{
	return Location_Distance_Recorder<DistanceMap>(d);
}

void ACustomGameState::Create BoardGraph()
{
	typedef adjacency_list<vecS, vecS, bidirectionalS, property<vertex_name_t, std::string>, property<edge_name_t, std::string>> Graph;

	Graph BoardGraph;

	typedef property_map<Graph, vertex_name_t>::type location_name_map_t;
	location_name_map_t Location_Name = get(vertex_name, BoardGraph);

	typedef property_map<Graph, edge_name_t>::type MovementType_map_t;
	MovementType_map_t Movement_Type = get(edge_name, BoardGraph);

	typedef graph_traits <Graph>::vertex_descriptor Vertex;
	typedef std::map <std::string, Vertex> NameVertexMap;
	NameVertexMap LocationVertexMap;


	for (int i = 0; i < Locations.Num(); ++i)
	{
	// Location from
	Vertex u;

	// Location To
	Vertex v;


	bool bIsInserted;

	
	NameVertexMap::iterator pos;

	
	boost::tie(pos, bIsInserted) = VertexMap.insert(std::make_pair(Locations*->Name, Vertex()));

	if (bIsInserted)
	{
	u = add_vertex(BoardGraph);
	Location_Name =Locations*->Name;
	
	pos->second = u;
	}
	else
	{
	// the vertex is already in the graph just the vertex descriptor
	u = pos->second;
	}

	// Do the same thing for the OutEdge locations
	for (int j = 0; j < Locations*->OutEdges.Num(); ++j)
	{
	boost::tie(pos, bIsInserted) = LocationVertexMap.insert(std::make_pair(Locations*->OutEdges[j].Name, Vertex()));
	if (bIsInserted)
	{
	v = add_vertex(BoardGraph);
	Location_Name[v] = Locations*->OutEdges[j].Name;
	pos->second = v;
	}
	else
	{
	v = pos->second;
	}


	graph_traits<Graph>::edge_descriptor e;
	boost::tie(e, bIsInserted) = add_edge(u, v, BoardGraph);
	if (bIsInserted)
	{
	Movement_Type[e] = Locations*->OutEdges[j].MovementType;
	}
	}
	}

	std::vector<int> LocationDistance(5);

	Vertex src = LocationVertexMap"StartingLocation"];
	LocationDistance[src] = 0;
	breadth_first_search(BoardGraph, src, visitor(record_distance_number(&LocationDistance[0])));
}

Any Ideas?

Thanks

I was able to get it working by disabling the warning (turned error) with #pragma warning (disable:4610)

This is pretty much a hack to get it to work (and I verified that the function indeed runs correctly in unreal) so if someone knows the correct solution that would be great