This worked in VC++ 6 but in Visual Studio 2010 assign needs a second parameter,
in the context of this function would it be a better idea to use resize or reserve and why?

bool CN3ShapeExtra::Load(HANDLE hFile)
{
	bool bSuccess = CN3Shape::Load(hFile);

	int iPC = m_Parts.size();
	m_Rotations.clear();
	if(iPC <= 0) return bSuccess;

	m_Rotations.assign(iPC);

	return bSuccess;
}

What type is "m_Rotations"?

struct __Rotation
	{
		float			fRadianPerSec;	// ĆŹ´ē ČøĄü.. Radian...
		__Vector3		vAxis;			// ČøĄüĆą..
		float			fRadianCur;		// ĒöĄē ČøĄü°Ŗ..
		float			fRadianToReach;	// ČøĄü½Ćų°Ŗ..

		__Rotation()
		{
			memset(this, 0, sizeof(__Rotation));
			vAxis.Set(0,1,0);
		}
	};

std::vector<__Rotation> m_Rotations;

vector::assign needs more than one parameter.
So if you want to load only one number you could use m_Rotations.assign(1, iPC); But you're trying to assign one integer value in a vector of structs, so there's your problem.

1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\vector(1035): error C2440: 'type cast' : cannot convert from 'int' to 'CN3ShapeExtra::__Rotation'
1>          No constructor could take the source type, or constructor overload resolution was ambiguous
1>          c:\program files (x86)\microsoft visual studio 10.0\vc\include\vector(1029) : see reference to function template instantiation 'void std::vector<_Ty>::_Assign<_Iter>(_Iter,_Iter,std::_Int_iterator_tag)' being compiled
1>          with
1>          [
1>              _Ty=CN3ShapeExtra::__Rotation,
1>              _Iter=int
1>          ]
1>          c:\users\user\desktop\client code\n3base\n3shapeextra.cpp(39) : see reference to function template instantiation 'void std::vector<_Ty>::assign<int>(_Iter,_Iter)' being compiled
1>          with
1>          [
1>              _Ty=CN3ShapeExtra::__Rotation,
1>              _Iter=int
1>          ]

Yeah, that's what I said. You can't put an int in a vector of structs. So what exactly was that line supposed to do?

Im not sure, thats why Im asking, but from the context I think back in VC 6 .assign took 1 parameter that worked like resize, so I just went with resize and the code works. I hate to leave this as is (this thing needs more closure) but Im marking this as solved, the vast spaces of the internets do not have anything I can consider as a final resolution. It was either a falt on the compilers part for not following the standard or the programmer who wrote the code was lazy and didnt follow the standard.

Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.