mercredi 17 octobre 2018

C++ std::swap invalid arguments

I have been trying to use the std::swap function on C++:

#include <iostream>

int main(int argc, char * argv[]){
    int i(2);
    int j(3);
    std::cout << i << std::endl << j << std::endl;
    using std::swap;
    swap(i,j);
    std::cout << i << std::endl << j << std::endl;
}

But I can't figure out why I have this error message in the editor under the swap function:

Invalid arguments ' Candidates are: std::enable_if<74 0 value 14 std::__and_ 3 14 std::__not_ 1 14 std::__is_tuple_like 1 #0 14 std::is_move_constructible 1 #0 14 std::is_move_assignable 1 #074 0 value 14 std::__and_ 3 14 std::__not_ 1 14 std::__is_tuple_like 1 #0 14 std::is_move_constructible 1 #0 14 std::is_move_assignable 1 #0,void>::type swap(#0 &, #0 &) std::enable_if<74 0 value 14 std::__and_ 2 14 std::__is_swappable 1 #0 14 std::__is_swappable 1 #174 0 value 14 std::__and_ 2 14 std::__is_swappable 1 #0 14 std::__is_swappable 1 #1,void>::type swap(std::pair<#0,#1> &, std::pair<#0,#1> &) std::enable_if::type swap(std::pair<#0,#1> &, std::pair<#0,#1> &) void swap(std::__cxx11::basic_string<#0,#1,#2> &, std::__cxx11::basic_string<#0,#1,#2> &) std::enable_if<74 0 value 14 std::__is_swappable 1 #074 0 value 14 std::__is_swappable 1 #0,void>::type swap(#0 (&)[3 #1 0], #0 (&)[3 #1 0]) '

What is particularly strange is that it appears only in the editor but when i execute, it seems to work perfectly... I've been trying to restart multiple times, and I also tried with different types of objects but nothing changed.

I am using Eclipse on Windows with MinGW Toolchain.

Thanks in advance for your help.

Aucun commentaire:

Enregistrer un commentaire