title: Basic C++: How do I initialize a struct member of a class?
body: <p>I've looked all over the place, but haven't found an answer to this.</p>
  
  <p>I have a C++ class with these protected members:</p>
  
  <pre><code> struct tm  _creationDate;
   struct tm  _expirationDate;
   struct tm  _lockDate;
  </code></pre>
  
  <p>I want to initialize them at instantiation time.  If I put this in the constructor:</p>
  
  <pre><code> _creationDate = {0};
   _expirationDate = {0};
   _lockDate = {0};
  </code></pre>
  
  <p>the compiler complains: "expected primary-expression before '{' token"</p>
  
  <p>I also can't find a way to do it in a member-initializer list at the top of the constructor.  How does one do this?  Thanks!</p>
  
  <p>FOLLOW-UP:
  Thanks for the replies, guys. You can't do it at the declaration; that's not allowed. So the only way appears to be memset or setting the members individually. I ended up writing a utility function to do just that. </p>