0

The following code was compiled with g++ using the flags -O0 -g3 (no optimization and request additional debug information respectively)

#include <bits/stdc++.h>
using namespace std;

void foo(unordered_set<int> b)
{
    if (b.size()>0)
        cout<<*b.begin()<<endl;
}
int main(void)
{
    unordered_set<int> c={1};
    foo(c);
}

I am single stepping using Eclipse IDE for C/C++ , Oxygen.1a Release.
When I try to single step into foo() the debugger begins displaying the many lines of the C++ Standard Library unordered_set copy constructor code. If I step out of the copy constructor code this results in foo() also being stepped over. I could set a breakpoint in foo, or run to a line in foo, but this is inconvenient. Is there a simpler way to avoid single stepping thru the copy constructor code and directly into foo()?

monzie
  • 565
  • 5
  • 15
  • 1
    Pass the set by reference, not by value. And do NOT do `#include ` –  Feb 21 '18 at 22:50
  • Well, VS has a Step into Specific button. I don't know if Eclipse has an equivalent option. – Arnav Borborah Feb 21 '18 at 22:54
  • When you step into a function on accident, all the debugger's I've used let you step out of the function. On gdb, the command is `finish`, but Eclipse may expose that functionality on some hotkey – Justin Feb 21 '18 at 22:56

0 Answers0