Guest User

Untitled

a guest
Jul 3rd, 2024
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. class foo
  2. {
  3. public:
  4.     foo() noexcept : m_index(0)
  5.     {
  6.     }
  7.  
  8.     void operator ++ () noexcept
  9.     {
  10.         if (m_index < 8)
  11.             ++m_index;
  12.         else
  13.             m_index = 0;
  14.     }
  15.  
  16.     char value() const noexcept
  17.     {
  18.         return m_value_jump[m_index];
  19.     }
  20.  
  21.     private:
  22.     char m_index;
  23.     static constexpr std::array<const char, 8> m_value_jump = { 3,8,4,3,7,0,1,1 }; //random values
  24. };
Advertisement
Add Comment
Please, Sign In to add comment