Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9274041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:15:35+00:00 2026-06-18T16:15:35+00:00

class RLE_v1 { struct header { char sig[4]; int fileSize; unsigned char fileNameLength; std::string

  • 0
class RLE_v1
{
    struct header
    {
        char sig[4];
        int fileSize;
        unsigned char fileNameLength;
        std::string fileName;
    } m_Header;

    RLE<char> m_Data;

public:
    void CreateArchive(const std::string& 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<unsigned int>(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& source);
};

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 no match for operator "=" matches these operands. I have no idea how to make them equal, because m_Data is already of type char.

This is the RLE class that has the variable m_Data as a mem

template <typename T>
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;
    }
};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T16:15:36+00:00Added an answer on June 18, 2026 at 4:15 pm

    You’ve shown everything except the actual line that produces the error.

    But what I see is this. You have a class that has the member:

    RLE<char> m_Data;
    

    After template expansion, that struct will have the member:

    char *m_Data;
    

    You say there is no operator= when you assign memblock to m_Data. So I can only conclude that you are doing this:

    m_Data = memblock;
    

    Where you should actually be doing this:

    m_Data.m_Data = memblock;
    m_Data.m_Size = size;
    

    Instead of directly operating on a struct’s internals, you might be better off making a function:

    template <typename T>
    void RLE<T>::Alloc( size_t size )
    {
        if( m_Data != nullptr ) delete [] m_Data;
        m_Data = new T [size];
        m_Size = size;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

class EventDataValue { public: enum Types { NONE, INT, STRING, DOUBLE, ULONG }; EventDataValue()
class Item { private int address; private String itemString; public Item(String item) { separate(item);
class object { public: void check() { std::cout<<I am doing ok...<<std::endl; } }; int
class Widget; std::vector< std::shared_ptr<Widget> > container class Criterium { public: bool operator()(const Widget& left,
class X { int i; public: X() { i = 0; } void set(int
class A{ virtual int foo1(int a){ return foo1_1(a,filler(a)); } template<typename FunctionPtr_filler> int foo1_1(int a,
class Test { public static void main(String[] args) throws Exception { Test t =
class a{ public void foo(int a){ System.out.println(super); } } class b extends a{ public
class EverythingMustBeInAClass { private final int i = 42; private final int[] a =
class A { public void printFirst(int... va) throws IOException{ System.out.print(A); } public static void

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.