C2825 error

following code will generate a C2825 error in VS2005Beta2 July:


#include "stdafx.h"
#include <vector>
#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{
int i = 3, j = 6;
std::swap<int>(i, j);//C2825
//but use std::swap<> <i, j>; will be ok
return 0;
}

I don't know why this , but who else can explain it to me?
many thanks.

[777 byte] By [pangwa] at [2007-12-20]
# 1

Have you reviewed the documentation for that error?

http://msdn2.microsoft.com/library/f9w3ffht(en-us,vs.80).aspx

I know it's a bit sparse, but it should give you some indication.

RobCaronMSFT at 2007-9-10 > top of Msdn Tech,Visual Studio Team System,Visual Studio Performance Tools (Profiler)...
# 2

I get this error too. If you uncomment the include <vector> it does not build (error C2825). The compiler seems to get confused between the swap() method in <vector> and the one in Utility (for primative types).

#include "stdafx.h"

//#include <vector>

#include <utility>

int _tmain(int argc, _TCHAR* argv[])

{

int a = 1;

int b = 2;

std::swap<int>(a, b);

return 0;

}

IDBS_James at 2007-9-10 > top of Msdn Tech,Visual Studio Team System,Visual Studio Performance Tools (Profiler)...

Visual Studio Team System

Site Classified