title: c++ function that takes any data type without using templates?
body: <p>I have assignment which asks one to write a function for any data type.The function is supposed to print the bytes of the structure and identify the total number of bytes the data structure uses along with differentiating between bytes used for members and bytes used for padding. </p>
  
  <p>My immediate reaction, along with most of the classes reaction was to use templates. This allows you to write the function once and gather the run time type of the objects passed into the function. Using memset and typeid's one can easily accomplish what has been asked. However, our prof. just saw our discussion about templates and damned templates to hell. </p>
  
  <p>After seeing this I was thrown for a loop and I'm looking for a little guidance as the best way to get around this. Some things I've looked into:</p>
  
  <ul>
  <li>void pointers with explicit casting (this seems like it'd get messy)</li>
  <li>base class with virtual functions only from which all data structures inherit from, seems a bit odd to do. </li>
  <li>a base class with 'friendships' to each of our data structures. </li>
  <li>rewriting a function for each data structure in our problem set (what I imagine is the worst possible solution). </li>
  </ul>
  
  <p>Was hoping I overlooked a common c++ tool, does anyone have any ideas? </p>