c++ : Error at compile time during assignement of a std::string to template parameter : i'm facing with something which i'm struggling to understand (and solve).
I'm using c++ 11, with visual studio 2013. 
Here is my context: I would like to call a template method :


    template<typename T> bool InvokeMyMethod(std::string methodName, T &retValue, int  modeType...)

and pass it template parameter as return value. In this way, i would call this function using integer, float , std::string parameters.
But, when i try to assign std::string to template parameter, i get compile error. Let me to write both .h anc .cpp code:

//************  INCLUDE  ******

...include files ...
 

    int  IncValue(int iParam)
    {
    return ++iParam;
    }
    float DivValue(float fParam)
    {
	return (fParam / 2);
    }
    const char* GetHello()
    {
	return "Hello\n";
    }

    template<typename T> bool InvokeMyMethod(std::string methodName, T &retValue, int  modeType...)
    {
    bool bRet = false;
	switch (modeType)
	{
	case 0:  // basic
	{
	std::cout << " Method " << methodName << " correctly invoked ." << std::endl;
	bRet = true;
	}
	break;
	case 1:  //call int function
	{
	va_list args;
	va_start(args, modeType);
	int iParam = va_arg(args, int);
	int result = IncValue(iParam);
	va_end(args);
	retValue = result;
	bRet = true;
	}
	break;

	case 2:   // call float function
	{
	va_list args;
	va_start(args, modeType);
	float fParam = (float)va_arg(args, double);
	float result = DivValue(fParam);
	va_end(args);
	retValue = result;
	bRet = true;
    }
	break;

	case 3:  //call string function
	{
		const char *strReturn = GetHello();
		std::string sValReturned;
		sValReturned = strReturn;
		std::cout << " Template for string : " << typeid(T).name() << std::endl;

    //HERE IS MY PROBLEM AT COMPILE TIME
	retValue = sValReturned;  // if i comment this line, everything is  
                              // ok, otherwise i got compiling error            
                              // like: error C2440: '=' : cannot convert 
                              // from 'std::string' to 'int' 
                              // AND
                              // cannot convert from 'std::string' to 
                              // 'float'
		bRet = true;
	}
	break;
	}
	return bRet;
    }

//**************** CPP :   MAIN *****************

.. include files ...

    int main()
    {
	std::string strMethod = "";
	strMethod = "Method_A";
	int iResult = 0;
	int iParam = 10;
	if (InvokeMyMethod(strMethod, iResult, 1,iParam))
	{
		std::cout << " Invoke  Method " << strMethod << "  returns : " << iResult << std::endl;
	}
	else
	{
		std::cout << " Error : Invoke Method " << strMethod << ". Method or Class not found!" << std::endl;
	}

	strMethod = "Method_B";
	float fResult = 0;
	float fParam = 9.0f;
	if (InvokeMyMethod(strMethod, fResult, 2, fParam))
	{
		std::cout << " Invoke  Method " << strMethod << "  returns : " << fResult << std::endl;
	}
	else
	{
		std::cout << " Error : Invoke  Method " << strMethod << ". Method or Class not found!" << std::endl;
	}

	strMethod = "Method_C";
	std::string sResult ="";
	std::string sParam = "Hello";
	if (InvokeMyMethod(strMethod, sResult, 3, sParam))
	{
		std::cout << " Invoke  Method " << strMethod << "  returns : " << sResult << std::endl;
	}
	else
	{
		std::cout << " Error : Invoke  Method " << strMethod << ". Method or Class not found!" << std::endl;
	}


	std::cout << "Press any key...";
	std::cin.get();
	return 0;
    }

When i try to assign (In the .h file, in the template method) the string value to template parameter, i get compile error. 

error C2440: '=' : cannot convert from 'std::string' to 'int' 
 and cannot convert from 'std::string' to 'float'

How i can solve this problem?
Thank you in advance

Andrea

