#include <vector>
#include <iostream>
#include <algorithm>
#include <initializer_list>

struct flag {
  bool set = false;
  template <class T> void operator=(const T&) { set = true; }
  flag& operator++() { return *this; }
  flag& operator*()  { return *this; }
};

template <class CLeft, class CRight>
bool intersects(const CLeft& lhs, const CRight& rhs) {
  flag f;
  return std::set_intersection(lhs.begin(), lhs.end(), rhs.begin(), rhs.end(), f).set;
}

bool check(const std::vector<int>& lhs, const std::vector<int>& rhs) {
  return intersects(lhs, rhs);
}

int main() {
  std::cout << std::boolalpha;
  std::cout << "{1, 2} ∩ {3, 4} ? " << check({1, 2}, {3, 4}) << "\n";
  std::cout << "{1, 2} ∩ {0, 2} ? " << check({1, 2}, {0, 2}) << "\n";
  std::cout << "{} ∩ {} ? " << check({}, {}) << "\n";
  std::cout << "{1, 2} ∩ {} ? " << check({1, 2}, {}) << "\n";
  std::cout << "{1} ∩ {1} ? " << check({1}, {1}) << "\n";
  return 0;
}