// enabl.cc -*- mode:c++, compile-command:"g++ -Wall -Wextra -pedantic -std=c++0x enabl.cc -o enabl && ./enabl" -*-
#include <iostream>
#include <algorithm>
#include <vector>

template <bool R, bool W>
struct X {
  template <bool Enabled = R,
            typename = typename std::enable_if<Enabled>::type>
  void read() {}
  template <bool Enabled = W,
            typename = typename std::enable_if<Enabled>::type>
  void write() {}
  bool is_open() const {};
};

int main()
{
  { X<true, true> x; x.read(); x.write(); }
  { X<false, true> x;          x.write(); }
  { X<true, false> x; x.read(); }
  { X<false, false> x;  }
}

