fork download
  1. struct MakeFlags
  2. {
  3. template <class T>
  4. friend T operator |(T a, T b) { return (T) ((int) a | (int) b); }
  5. template <class T>
  6. friend T operator &(T a, T b) { return (T) ((int) a & (int) b); }
  7. };
  8.  
  9. struct Flags : MakeFlags {
  10. enum T { Flag1 = 1, Flag2 = 2, Flag3 = 4 };
  11. };
  12.  
  13. int main()
  14. {
  15. Flags::T test = Flags::Flag1 | Flags::Flag2;
  16. return 0;
  17. }
Success #stdin #stdout 0s 2892KB
stdin
Standard input is empty
stdout
Standard output is empty