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 » U++ Library support » U++ Core » C++11: Vector is missing copy contructor/assignment operator (Compiling for C++11 with gcc 4.8 or newer fails)
C++11: Vector is missing copy contructor/assignment operator [message #43173] Wed, 28 May 2014 10:24 Go to previous message
steffen is currently offline  steffen
Messages: 38
Registered: May 2007
Location: Denmark
Member

Hi,

OS: Ubuntu 14.04
uppsrc revision 7400
gcc version 4.8.2

It seems that from gcc-4.8, the Vector class gives a compiler error when building with the -std=c++0x flag.
According to C++11 specs, it is a valid error, since it should not implicitly make copy constructors for moveable objects.

Example:
CONSOLE_APP_MAIN
{
	Vector<int> v;
	Vector<int> r = v;

	VectorMap<int,String> vm;
	VectorMap<int,String> rvm = vm;
	Vector<String> rv = vm.GetValues();
}

Compiler gives these errors:
/home/steffen/Projects/Ultimatepp/VectorTest/VectorTest.cpp: In function 'void ConsoleMainFn_()':
/home/steffen/Projects/Ultimatepp/VectorTest/VectorTest.cpp:10:18: error: use of deleted function 'constexpr Upp::Vector<int>::Vector(const Upp::Vector<int>&)'
  Vector<int> r = v;
                  ^
In file included from /home/steffen/Projects/upp/uppsrc/Core/Core.h:282:0,
                 from /home/steffen/Projects/Ultimatepp/VectorTest/VectorTest.cpp:1:
/home/steffen/Projects/upp/uppsrc/Core/Vcont.h:13:7: note: 'constexpr Upp::Vector<int>::Vector(const Upp::Vector<int>&)' is implicitly declared as deleted because 'Upp::Vector<int>' declares a move constructor or move assignment operator
 class Vector : public MoveableAndDeepCopyOption< Vector<T> > {
       ^
/home/steffen/Projects/Ultimatepp/VectorTest/VectorTest.cpp:13:30: error: use of deleted function 'Upp::VectorMap<int, Upp::String>::VectorMap(const Upp::VectorMap<int, Upp::String>&)'
  VectorMap<int,String> rvm = vm;
                              ^
In file included from /home/steffen/Projects/upp/uppsrc/Core/Core.h:285:0,
                 from /home/steffen/Projects/Ultimatepp/VectorTest/VectorTest.cpp:1:
/home/steffen/Projects/upp/uppsrc/Core/Map.h:145:7: note: 'Upp::VectorMap<int, Upp::String>::VectorMap(const Upp::VectorMap<int, Upp::String>&)' is implicitly deleted because the default definition would be ill-formed:
 class VectorMap : public MoveableAndDeepCopyOption<VectorMap<K, T, HashFn> >,
       ^
/home/steffen/Projects/upp/uppsrc/Core/Map.h:145:7: error: use of deleted function 'Upp::AMap<int, Upp::String, Upp::Vector<Upp::String>, Upp::StdHash<int> >::AMap(const Upp::AMap<int, Upp::String, Upp::Vector<Upp::String>, Upp::StdHash<int> >&)'
/home/steffen/Projects/upp/uppsrc/Core/Map.h:2:7: note: 'Upp::AMap<int, Upp::String, Upp::Vector<Upp::String>, Upp::StdHash<int> >::AMap(const Upp::AMap<int, Upp::String, Upp::Vector<Upp::String>, Upp::StdHash<int> >&)' is implicitly deleted because the default definition would be ill-formed:
 class AMap {
       ^
/home/steffen/Projects/upp/uppsrc/Core/Map.h:2:7: error: use of deleted function 'Upp::Index<int>::Index(const Upp::Index<int>&)'
In file included from /home/steffen/Projects/upp/uppsrc/Core/Core.h:284:0,
                 from /home/steffen/Projects/Ultimatepp/VectorTest/VectorTest.cpp:1:
/home/steffen/Projects/upp/uppsrc/Core/Index.h:210:7: note: 'Upp::Index<int>::Index(const Upp::Index<int>&)' is implicitly declared as deleted because 'Upp::Index<int>' declares a move constructor or move assignment operator
 class Index : MoveableAndDeepCopyOption< Index<T, HashFn > >,
       ^
In file included from /home/steffen/Projects/upp/uppsrc/Core/Core.h:285:0,
                 from /home/steffen/Projects/Ultimatepp/VectorTest/VectorTest.cpp:1:
/home/steffen/Projects/upp/uppsrc/Core/Map.h:2:7: error: use of deleted function 'constexpr Upp::Vector<Upp::String>::Vector(const Upp::Vector<Upp::String>&)'
 class AMap {
       ^
In file included from /home/steffen/Projects/upp/uppsrc/Core/Core.h:282:0,
                 from /home/steffen/Projects/Ultimatepp/VectorTest/VectorTest.cpp:1:
/home/steffen/Projects/upp/uppsrc/Core/Vcont.h:13:7: note: 'constexpr Upp::Vector<Upp::String>::Vector(const Upp::Vector<Upp::String>&)' is implicitly declared as deleted because 'Upp::Vector<Upp::String>' declares a move constructor or move assignment operator
 class Vector : public MoveableAndDeepCopyOption< Vector<T> > {
       ^
/home/steffen/Projects/Ultimatepp/VectorTest/VectorTest.cpp:14:35: error: use of deleted function 'constexpr Upp::Vector<Upp::String>::Vector(const Upp::Vector<Upp::String>&)'
  Vector<String> rv = vm.GetValues();

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Unterminated processing info in XmlParser
Next Topic: Is XML compression possible by U++ library call?
Goto Forum:
  


Current Time: Thu May 09 07:55:50 CEST 2024

Total time taken to generate the page: 0.02995 seconds