Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » error: call to implicitly-deleted copy constructor
error: call to implicitly-deleted copy constructor [message #56334] Tue, 23 February 2021 04:29 Go to previous message
sinpeople is currently offline  sinpeople
Messages: 29
Registered: October 2020
Location: Singapore
Promising Member

Hi folks,

Newbie here.

I got this "call to implicitly-deleted copy constructor" error in this very simple program.

The error changes to "no matching constructor for initialization of xxx" after I added a copy constructor into the class. Adding a default constructor explicitly into the code didn't get rid of this new error.

The code is attached with the copy constructor and default constructor in comment. If the .push_back statement is commented, no error will show up. I guess it has something to do with the containers, which i am not familiar at all.

Please help me. Thank you very much!



Best Regards
David
============================================================ ===
#include <Core/Core.h>
#include <deque>

using namespace Upp;
using namespace std;

struct AMessage 
{
   virtual void Serialize(Stream& s) = 0;
   virtual ~AMessage() {}
};

struct SignalStatus : Moveable<SignalStatus> {
	int sg_ID;
	int sg_Color;
	int sg_Elapsed;
    virtual void Serialize(Stream& s) {
       s % sg_ID % sg_Color % sg_Elapsed;
    }
};

struct SignalStatusMessage : AMessage {
	int nTime;
	Vector<SignalStatus> status;
/*
    SignalStatusMessage(){};
    SignalStatusMessage(SignalStatusMessage& temp)
    {
        nTime = temp.nTime;
        status.clear();
        for(int i=0; i<temp.status.size(); i++)
        {
            SignalStatus sgStatus;
            sgStatus.sg_ID = temp.status[i].sg_ID;
            sgStatus.sg_Color = temp.status[i].sg_Color;
            sgStatus.sg_Elapsed = temp.status[i].sg_Elapsed;
        	status.push_back(sgStatus);
        }
    }
*/
    virtual void Serialize(Stream& s) {
       s % nTime % status;
    }
};


CONSOLE_APP_MAIN
{
	//deque<String> deqAbs;
	SignalStatusMessage sigStatus;
	deque<SignalStatusMessage> deqSigStatus;
	
	deqSigStatus.push_back(sigStatus);
}

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [Solved]Vector<Vector<int>> problem
Next Topic: Compile time hash macro
Goto Forum:
  


Current Time: Tue Apr 30 18:57:13 CEST 2024

Total time taken to generate the page: 0.02853 seconds