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 » again... use if deleted function :?
Re: again... use if deleted function :? [message #49305 is a reply to message #49301] Sun, 21 January 2018 12:43 Go to previous messageGo to previous message
idkfa46 is currently offline  idkfa46
Messages: 155
Registered: December 2011
Experienced Member
Thank you Oblivion,
I read something about copy and move semantics and I solved my issue defining a copy constructor as you suggested.

By the way is not clear for me when you write:
Quote:

// By the way, returning a QTFStr from this function shoudn't be necessasy at all, since you are already modifying the referenced instance! (it is non-const), unless you really need a copy of it. It is a much cheaper solution.


What is the much cheaper solution?

And then, how can I define a copy constructor for a Template<class T> function such as:

template<class T> void SortDurata(VectorMap<int, T> &Load) 
{ 
	//Riordina VectorMap in ordine crescente
	Vector<int> keys = Load.PickKeys();
	Vector<T> values = Load.GetValues();
	IndexSort(keys, values);
	Load.Clear();
	Load = VectorMap<int, T>(keys, values);
}


C:\Users\Matteo\Dropbox\2_Sviluppo++\Workspace_upp\LibCombiner\TabellaCarichi.cpp (192): error: use of deleted function 'Upp::VectorMap<Upp::String, Upp::Vector<Upp::Value> >& Upp::VectorMap<Upp::String, Upp::Vector<Upp::Value> >::operator=(const Upp::VectorMa
p<Upp::String, Upp::Vector<Upp::Value> >&)'
C:\upp/uppsrc/Core/Map.h (193): error: use of deleted function 'Upp::AMap<Upp::String, Upp::Vector<Upp::Value>, Upp::Vector<Upp::Vector<Upp::Value> > >& Upp::AMap<Upp::String, Upp::Vector<Upp::Value>, U
pp::Vector<Upp::Vector<Upp::Value> > >::operator=(const Upp::AMap<Upp::String, Upp::Vector<Upp::Value>, Upp::Vector<Upp::Vector<Upp::Value> > >&)'
C:\upp/uppsrc/Core/Map.h (33): error: use of deleted function 'Upp::Index<Upp::String>& Upp::Index<Upp::String>::operator=(const Upp::Index<Upp::String>&)'
C:\upp/uppsrc/Core/Index.h (80): note: 'Upp::Index<Upp::String>& Upp::Index<Upp::String>::operator=(const Upp::Index<Upp::String>&)' is implicitly declared as deleted because 'Upp::Index<Upp::String>' declares a
 move constructor or move assignment operator
 (): class Index : MoveableAndDeepCopyOption<Index<T>> {
C:\upp/uppsrc/Core/Map.h (33): error: use of deleted function 'constexpr Upp::Vector<Upp::Vector<Upp::Value> >& Upp::Vector<Upp::Vector<Upp::Value> >::operator=(const Upp::Vector<Upp::Vector<Upp::Value>
 >&)'
C:\Users\Matteo\Dropbox\2_Sviluppo++\Workspace_upp\LibCombiner\TabellaCarichi.cpp (195): error: use of deleted function 'Upp::VectorMap<Upp::String, Upp::Vector<Upp::Value> >& Upp::VectorMap<Upp::String, Upp::Vector<Upp::Value> >::operator=(const Upp::VectorMa
p<Upp::String, Upp::Vector<Upp::Value> >&)'
C:\Users\Matteo\Dropbox\2_Sviluppo++\Workspace_upp\LibCombiner\Combiner.h (112): error: use of deleted function 'constexpr Upp::Vector<_G>::Vector(const Upp::Vector<_G>&)'
C:\Users\Matteo\Dropbox\2_Sviluppo++\Workspace_upp\LibCombiner\Combiner.h (115): error: cannot bind rvalue reference of type 'Upp::Vector<int>&&' to lvalue of type 'Upp::Vector<int>'
C:\Users\Matteo\Dropbox\2_Sviluppo++\Workspace_upp\LibCombiner\Combiner.h (112): error: use of deleted function 'constexpr Upp::Vector<_Q>::Vector(const Upp::Vector<_Q>&)'
C:\Users\Matteo\Dropbox\2_Sviluppo++\Workspace_upp\LibCombiner\Combiner.h (115): error: cannot bind rvalue reference of type 'Upp::Vector<int>&&' to lvalue of type 'Upp::Vector<int>'


Best regards,
Matteo

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Stacked column chart
Next Topic: Issue encountered building U++...
Goto Forum:
  


Current Time: Sat May 04 14:37:03 CEST 2024

Total time taken to generate the page: 0.02450 seconds