Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange compilation error for a move constructor

I'm trying to make a move constructor but I get the error

expected ',' or '...' before '&&' token

This is the line that's causing the trouble:

List(List&& list) noexcept;

I also have a copy-constructor that looks similiar. Dont know if that might cause trouble:

List(const List& copy);

(this is all in the header file for my List class)

like image 972
Johan Hjalmarsson Avatar asked Dec 21 '22 23:12

Johan Hjalmarsson


1 Answers

Make sure you use a compiler that can compile C++11 code (and is set to do so), this is not valid in previous versions of the C++ standard

like image 113
Attila Avatar answered Dec 24 '22 02:12

Attila