title: c++ assignment operator overloading
body: <p>Hello everyone i'm trying to write an assignment operator for this class so i can assign an array like this<code>int[] = {0, 1, 2, 3}</code> to my Tableau class</p>
  
  <p>originally i wanted to do this </p>
  
  <pre><code>Tableau&lt;T&gt;&amp; operator=(T arr[])
  {
   return Tableau(tab, sizeofarray);
  }
  </code></pre>
  
  <p>because i already wrote a constructor that takes and array and the size as its argument </p>
  
  <p>and i ran into a problem with the size of the the array i don't know how to find it 
  how can i find the size of the array or is there a better way to do this</p>
  
  <pre><code>template&lt;typename T&gt;
  class Tableau
  { 
  public:
  Tableau(int s = 0) : size(s), ptr(new T[size])
  {
      for (int i = 0; i &lt; size; i++)
      {
          ptr[i] = 0;
      }
  }
  Tableau(T tab[], int s = 0) : size(s), ptr(new T[size])
  {
      for (int i = 0; i &lt; size; i++)
      {
          ptr[i] = tab[i];
      }
  }
  
  ~Tableau()
  {
      delete[] ptr;
  }
  Tableau&lt;T&gt;&amp; operator=( T tab[])
  {
  
  }
  T commule()
  {
      T com = 0;
      for (int i = 0; i &lt; size; i++)
      {
          com += ptr[i];
      }
      return com;
  }
  T&amp; operator[](const int index)
  {
      return ptr[index];
  }
  private:
  int size;
  T* ptr;
  };
  
  int main()
  {
  int k[] = { 8, 12, 5, 9, 55};
  Tableau&lt;int&gt; TI(k, 2);
  TI = k;
  return 0;
  }
  </code></pre>