title: Why do STD implementations of mt19937 have double sizeof as boost version?
body: <p>I have this simple C++ program with unexpected output:</p>
  <pre><code>#include&lt;random&gt;
  #include&lt;iostream&gt;
  #include &quot;boost/random/mersenne_twister.hpp&quot;
  #include &quot;boost/random/uniform_int_distribution.hpp&quot;
  
  int main(){
      std::cout &lt;&lt; sizeof(std::mt19937) &lt;&lt; std::endl;
      std::cout &lt;&lt; sizeof(std::mt19937_64) &lt;&lt; std::endl;
      std::cout &lt;&lt; sizeof(boost::random::mt19937) &lt;&lt; std::endl;
      std::cout &lt;&lt; sizeof(boost::random::mt19937_64) &lt;&lt; std::endl;
  }
  </code></pre>
  <p><a href="https://godbolt.org/z/oEKeaM" rel="nofollow noreferrer">both clang and gcc output</a></p>
  <blockquote>
  <p>5000</p>
  <p>2504</p>
  <p>2504</p>
  <p>2504</p>
  </blockquote>
  <p>What I find interesting is that sizeof standard implementation of mt19937(32bit one) is around 2x the the boost version, while 64bit ones match perfectly.</p>
  <p>Since MT uses a lot of space it is not really a small difference.</p>
  <p>Also it is weird that implementation of a strictly specified algorithm would have such different sizeof, we are not talking about std::string where implementers might pick different SSO buffer size...</p>
  <p>My best guess would be that boost either has a bug or that it implements some slightly different version of mt19937, but wikipedia says this, suggesting boost might be right:</p>
  <blockquote>
  <p>Relatively large state buffer, of 2.5 KiB,</p>
  </blockquote>
  <p>edit: both boost and std version seem to <a href="https://godbolt.org/z/18vd8E" rel="nofollow noreferrer">satisfy requirement</a> that 1000th generated value is 4123659995, so there seems to be no bug in boost.</p>