I have developed windows application using VC++ which uses vector and queue (STL components). while running the application, I am getting error as "application.exe has triggered a breakpoint."
Adding call stack for more clarity.
ntdll.dll!RtlReportCriticalFailure () Unknown
ntdll.dll!RtlpHeapHandleError () Unknown
ntdll.dll!RtlpHpHeapHandleError () Unknown
ntdll.dll!RtlpLogHeapFailure () Unknown
ntdll.dll!RtlFreeHeap() Unknown
ucrtbased.dll!_free_base(void * block) Line 105 C++
ucrtbased.dll!free_dbg_nolock(void * const block, const int block_use) Line 1003 C++
ucrtbased.dll!_free_dbg(void * block, int block_use) Line 1030 C++
UnicastMulticastApp.exe!operator delete(void * block) Line 38 C++
UnicastMulticastApp.exe!operator delete(void * block, unsigned __int64 __formal) Line 32 C++
UnicastMulticastApp.exe!std::_Deallocate<16,0>(void * _Ptr, unsigned __int64 _Bytes) Line 221 C++
UnicastMulticastApp.exe!std::allocator<int *>::deallocate(int * * const _Ptr, const unsigned __int64 _Count) Line 804 C++
UnicastMulticastApp.exe!std::deque<int,std::allocator<int>>::_Tidy() Line 1483 C++
UnicastMulticastApp.exe!std::deque<int,std::allocator<int>>::~deque<int,std::allocator<int>>() Line 870 C++
UnicastMulticastApp.exe!bfs(std::vector<int,std::allocator<int>> * adj, std::vector<int,std::allocator<int>> * parent, int n, int start) Line 1540 C++
UnicastMulticastApp.exe!print_paths(std::vector<int,std::allocator<int>> * adj, int n, int start, int end) Line 1455 C++
int bfs(vector<int> adj[], vector<int> parent[], int n, int start)
{
// dist will contain shortest distance
// from start to every other vertex
vector<int> dist(n, INT_MAX);
queue<int> q;
// Insert source vertex in queue and make
// its parent -1 and distance 0
q.push(start);
parent[start] = { -1 };
dist[start] = 0;
// Untill Queue is empty
while (!q.empty()) {
int u = q.front();
q.pop();
for (int v : adj[u]) {
if (dist[v] > dist[u] + metricData[u][v]) {
// A shorter distance is found
// So erase all the previous parents
// and insert new parent u in parent[v]
dist[v] = dist[u] + metricData[u][v];
q.push(v);
parent[v].clear();
parent[v].push_back(u);
}
else if (dist[v] == dist[u] + metricData[u][v]) {
// Another candidate parent for
// shortes path found
parent[v].push_back(u);
}
}
}
for (int i = 0; i < n; i++) {
metricData[start][i] = dist[i];
}
return 0;
}