#include <fstream>
#include <iostream>
#include <string>
#include <typeinfo>
#include <vector>
using namespace std;
struct Node
{
	char name;
	vector< vector<Node>::iterator> exits;
	bool operator== (const Node& other) const { return name==other.name; }
	Node(char t)
	{
		name = t;
	}
};
int main ()
{
	ifstream in("input.txt");
	string tmp;
	vector<Node> graph;
	while (in >> tmp)
	{
		Node t (tmp[0]);
		Node t0 (tmp[2]);
		auto node = find(graph.begin(), graph.begin()+graph.size(), t);
		auto node_exit = find(graph.begin(), graph.begin()+graph.size(), t0);
		if (node == graph.end() && node_exit == graph.end())
		{
			graph.push_back(t);
			graph.push_back(t0);
			auto node = find(graph.begin(), graph.begin()+graph.size(), t);
			auto node_exit = find(graph.begin(), graph.begin()+graph.size(), t0);
			node->exits.push_back(node_exit);
		}
		else if (node_exit == graph.end())
		{
			graph.push_back(t0); // (*)
			auto node = find(graph.begin(), graph.begin()+graph.size(), t);
			auto node_exit = find(graph.begin(), graph.begin()+graph.size(), t0);
			node->exits.push_back(node_exit);
		}
		else
		{
			auto node = find(graph.begin(), graph.begin()+graph.size(), t);
			auto node_exit = find(graph.begin(), graph.begin()+graph.size(), t0);
			node->exits.push_back(node_exit);
		}
	}
	return 0;
}
Содержание input.txt:
A-B
B-C
После выполнения строчки (*) ломается итератор graph[0].exits[0] — должен указывать на B, а указывает на бурду. ЧЯДНТ?

