#pragma once #include #include #include namespace base { class MoveToFront { public: static size_t constexpr kNumBytes = static_cast(std::numeric_limits::max()) + 1; MoveToFront(); // Returns index of the byte |b| in the current sequence of bytes, then, moves |b| // to the first positions. uint8_t Transform(uint8_t b); uint8_t operator[](uint8_t i) const { return m_order[i]; } private: std::array m_order; }; } // namespace