title: Function to get minimal value of array in template
body: <p>I have this code in main:</p>
  
  <pre><code>Array&lt;int&gt; array1 = Array&lt;int&gt;(5);
  array1.coutArray();
  cout &lt;&lt; "Minimal value: " &lt;&lt; min(array1, 5);
  </code></pre>
  
  <p>And I need function to get minimal value of array. I Tried this function:</p>
  
  <pre><code>template&lt;class Array&gt;
  Array min(const Array* data, int size) {
      T result = data[0];
      for (int i = 1; i &lt; size; i++)
          if (result &gt; data[i])
              result = data[i];
      return result;
  }
  </code></pre>
  
  <p>But for every variant from internet I have one error about types of first argument. How to properly write this function or it's calling?
  Array class:</p>
  
  <pre><code>template &lt;class T&gt;
  class Array {
  protected:
      int size;
      T* DynamicArray;
  public:
      Array() {};
      Array(size_t s) : size(s) {
          DynamicArray = new T[size];
          for (int i = 0; i &lt; size; i++) {
              cout &lt;&lt; "Element " &lt;&lt; i+1 &lt;&lt; ": ";
              cin &gt;&gt; DynamicArray[i];
  
          }
      }
  
      void coutArray() {
          for (int i = 0; i &lt; size; i++) {
              cout &lt;&lt; DynamicArray[i] &lt;&lt; " ";
          }
      }
  
      ~Array() {
          delete[]DynamicArray;
      }
  };
  
  template&lt;class Array&gt;
  Array getMin(Array* arr, int size)
  {
      for (int i = 0; i &lt; size; i++) {
          cout &lt;&lt; arr[i];
      }
  }
  </code></pre>