#include <stdio.h>

#include <set>

#include <list>

std::list<int> stacktrace;

bool _log = true;

struct comp {

bool operator()(int x, int y) {

if (_log) {

stacktrace.push_back(x);

stacktrace.push_back(y);

} return x < y;

}

};

std::set<int, comp> a;

void flush() { stacktrace.clear(); }


레드-블랙 트리가 삽입 / 삭제 / 탐색 / 회전하는 것을 볼 수 있음.

그리고, 값 비교를 2번 하는 것을 볼 수 있을텐데 "!comp(a, b) && !comp(b, a)"로 같은걸 확인해야 하기 때문임.