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 » Developing U++ » U++ Developers corner » SortedVectorMap - attempting to reference a deleted function error (SortedVectorMap - attempting to reference a deleted function error)
SortedVectorMap - attempting to reference a deleted function error [message #49699] Fri, 06 April 2018 16:47 Go to next message
awksed is currently offline  awksed
Messages: 61
Registered: April 2012
Member
I get an "attempting to reference a deleted function" error compiling the following.

With VectorMap it compiles, with SortedVectorMap it fails.

Adding MyClass::operator= and copy ctor doesnt help.

Compiler: MSC15x64


#include <Core/Core.h>

using namespace Upp;

class MyClass : Moveable<MyClass>
{
int nDummy;
};


CONSOLE_APP_MAIN
{
Vector <MyClass> List;
SortedVectorMap <String, Vector<MyClass>> Info;

//VectorMap <String, Vector<MyClass>> Info; // THIS COMPILES

Info.Add("123", List); // <- fail
}


Produces:

c:\upp9251\uppsrc\core\InVector.h(629): error C2280: 'Upp::Vector<MyClass> &Upp::Vector<MyClass>::operator =(const Upp::Vector<MyClass> &)': attempting to reference a deleted function
Re: SortedVectorMap - attempting to reference a deleted function error [message #49701 is a reply to message #49699] Sat, 07 April 2018 00:53 Go to previous messageGo to next message
busiek is currently offline  busiek
Messages: 66
Registered: February 2011
Location: Poland
Member
Some U++ containers have deleted copy constructor. See transfer semantics. In your code you have to explicitly tell whether you copy or move like this:
Info.Add("123", clone(List));
or
Info.Add("123", pick(List));

Re: SortedVectorMap - attempting to reference a deleted function error [message #49702 is a reply to message #49699] Sat, 07 April 2018 09:39 Go to previous messageGo to next message
awksed is currently offline  awksed
Messages: 61
Registered: April 2012
Member
Hi, busiek

Many thanks for your reply.

Sorry, I should have said I tried that already. It's not a solution in this case.

Did you compile the code I posted? I havent tried it but it probably compiles on older compilers (again not a solution as I need (fairly) current compilers.

I also should mention I'm using U++ 9251 (I havent tried anything later).
Re: SortedVectorMap - attempting to reference a deleted function error [message #49716 is a reply to message #49699] Fri, 13 April 2018 10:14 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13995
Registered: November 2005
Ultimate Member
awksed wrote on Fri, 06 April 2018 16:47
I get an "attempting to reference a deleted function" error compiling the following.

With VectorMap it compiles, with SortedVectorMap it fails.

Adding MyClass::operator= and copy ctor doesnt help.

Compiler: MSC15x64


#include <Core/Core.h>

using namespace Upp;

class MyClass : Moveable<MyClass>
{
int nDummy;
};


CONSOLE_APP_MAIN
{
Vector <MyClass> List;
SortedVectorMap <String, Vector<MyClass>> Info;

//VectorMap <String, Vector<MyClass>> Info; // THIS COMPILES

Info.Add("123", List); // <- fail
}


Produces:

c:\upp9251\uppsrc\core\InVector.h(629): error C2280: 'Upp::Vector<MyClass> &Upp::Vector<MyClass>::operator =(const Upp::Vector<MyClass> &)': attempting to reference a deleted function


Thanks for reporting, fixed in the trunk.
Re: SortedVectorMap - attempting to reference a deleted function error [message #49823 is a reply to message #49716] Fri, 11 May 2018 13:48 Go to previous message
awksed is currently offline  awksed
Messages: 61
Registered: April 2012
Member
Hi Mirek,

Sorry for the delay in replying.

Many thanks.
Previous Topic: Kqueue/epoll based interface for TcpSocket and WebSocket
Next Topic: GIT support integration to the IDE
Goto Forum:
  


Current Time: Sat Jul 20 21:56:56 CEST 2024

Total time taken to generate the page: 0.02300 seconds