build.sh
clear && g++-10 a.cpp
watch.sh
clear && fswatch -0 --latency 0.2 --recursive --format "%f##%p" --event Updated -e ".*" -i ".*cpp$" ./ | xargs -0 -n 2 ./build.sh 2>&1
run.sh
sudo clear && ./a.out && echo "" && echo "Program exit"
a.cpp
#include <iostream> #include <map> using namespace std; class A { public: A(int i):num(i){} operator bool() const { return false; } bool operator <(const A& b) const { return this->num < b.num; }; int num=0; }; int main() { map<A,string> conta; conta.emplace(2,"foo"); conta.emplace(1,"one"); cout << conta.size()<<endl; for(auto i : conta) { cout<<i.first.num <<","<<i.second <<endl; } return 0; }