title: vector<string> vs string[] when passing to function
body: <p>I'm new to C++ and I'm trying to pass a collection of a nonvariable amount strings to a function that exists in separate class file in an easy to read manner as such:</p>
  
  <pre><code>//main in Caller.cpp
  int main()
  {
     string details[] = {"Name","Height","Weight"};
  
      /* vector&lt;string&gt; detailsV = {"Name","Height","Weight"}; 
       * Would like to use a vector but can't do this because vector cannot be 
       * initialized to = {...} in C++
       */
  
     Person p = Person();
     p.inspectDetails(details);
  }
  
  //Person class in Person.cpp
  void inspectDetails(string details [])
  {
     int sz = sizeof(details); // this will result in details = "Name" only
  }
  </code></pre>
  
  <p>I've tried:</p>
  
  <pre><code>//Person class in Person.cpp
  &lt;template size_t N&gt;
  void inspectDetails(string (&amp;details)[N])
  {
     int sz = sizeof(details); 
  }
  </code></pre>
  
  <p>However, I don't now how to let the main in the Caller class know about the <code>&lt;template size_t N&gt;</code> which might allow me to use an array of a non-explicit amount. I seem to get an error of "no suitable conversion of std:string[3] to std:string" when trying to call <code>inpectDetails</code> this way. </p>
  
  <p>What is the best way to pass a collection of strings of a non-explicit amount to a function outside of the Caller class whilst maintaining the ability to hardcode the collection's contents like so <code>Collection c = {"...", "...", "..."}</code> in C++? 
  Is there an easier way to pass the full collection of strings to a function with a pointer to a vector or something of that sort?</p>