title: C++ error — No match for operator =
body: <pre><code>class RLE_v1
  {
      struct header
      {
          char sig[4];
          int fileSize;
          unsigned char fileNameLength;
          std::string fileName;
      } m_Header;
  
      RLE&lt;char&gt; m_Data;
  
  public:
      void CreateArchive(const std::string&amp; source)
      {
          std::ifstream::pos_type size;
          char* memblock;
          std::ifstream file (source, std::ios::in|std::ios::binary|std::ios::ate);
          if (file.is_open())
          {
              size = file.tellg();
              memblock = new char [static_cast&lt;unsigned int&gt;(size)];
              file.seekg (0, std::ios::beg);
              file.read (memblock, size);
              file.close();
              //
              // trying to make assignment to m_Data here.
              //
              delete[] memblock;
          }
      }
  
      void ExtractArchive(const std::string&amp; source);
  };
  </code></pre>
  
  <p>I'm trying to copy the data in the "memblock" char array into the variable  m_Data, but when I try to do it I get the error that <code>no match for operator "=" matches these operands</code>. I have no idea how to make them equal, because <code>m_Data</code> is already of type <code>char</code>.</p>
  
  <p>This is the RLE class that has the variable m_Data as a mem</p>
  
  <pre><code>template &lt;typename T&gt;
  struct RLE
  {
  
      T* m_Data;  // Memory which stores either compressed or decompressed data
      int m_Size; // Number of elements of type T that data is pointing to
  
      RLE()
          : m_Data(nullptr)
          , m_Size(0)
      { }
  
      ~RLE()
      {
          delete m_Data;
      }
  };
  </code></pre>