Gray code class for C++