Click here to Skip to main content
15,898,795 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: query the no. of files selected using CFileDialog? Pin
David Crow12-May-03 8:03
David Crow12-May-03 8:03 
AnswerRe: query the no. of files selected using CFileDialog? Pin
John R. Shaw12-May-03 9:01
John R. Shaw12-May-03 9:01 
Generalsockets & pop3 Pin
ibiteu212-May-03 7:32
ibiteu212-May-03 7:32 
GeneralRe: sockets & pop3 Pin
Anders Molin12-May-03 8:04
professionalAnders Molin12-May-03 8:04 
GeneralRe: sockets & pop3 Pin
ibiteu212-May-03 8:12
ibiteu212-May-03 8:12 
GeneralRe: sockets & pop3 Pin
Anders Molin12-May-03 8:37
professionalAnders Molin12-May-03 8:37 
GeneralRe: sockets & pop3 Pin
ibiteu212-May-03 10:32
ibiteu212-May-03 10:32 
QuestionBest Way to Respond to IE dialog boxes? Pin
RickGavin12-May-03 7:28
RickGavin12-May-03 7:28 
AnswerRe: Best Way to Respond to IE dialog boxes? Pin
David Crow12-May-03 8:05
David Crow12-May-03 8:05 
GeneralRe: Best Way to Respond to IE dialog boxes? Pin
RickGavin12-May-03 9:19
RickGavin12-May-03 9:19 
GeneralDLL loading in debug and release mode Pin
Dominik Reichl12-May-03 7:22
Dominik Reichl12-May-03 7:22 
GeneralRe: DLL loading in debug and release mode Pin
valikac12-May-03 9:09
valikac12-May-03 9:09 
GeneralRe: DLL loading in debug and release mode Pin
Neville Franks12-May-03 13:04
Neville Franks12-May-03 13:04 
GeneralRe: DLL loading in debug and release mode Pin
Dominik Reichl13-May-03 0:23
Dominik Reichl13-May-03 0:23 
GeneralRe: DLL loading in debug and release mode Pin
Neville Franks13-May-03 1:32
Neville Franks13-May-03 1:32 
GeneralRe: DLL loading in debug and release mode Pin
Dominik Reichl13-May-03 1:57
Dominik Reichl13-May-03 1:57 
GeneralRe: DLL loading in debug and release mode Pin
Neville Franks13-May-03 2:04
Neville Franks13-May-03 2:04 
GeneralRe: DLL loading in debug and release mode Pin
Dominik Reichl13-May-03 2:09
Dominik Reichl13-May-03 2:09 
GeneralRe: DLL loading in debug and release mode Pin
Neville Franks13-May-03 2:13
Neville Franks13-May-03 2:13 
GeneralNamespace and Temmplate function Pin
Shah Shehpori12-May-03 5:57
sussShah Shehpori12-May-03 5:57 
Friends,
I wrote a simple template function, the purpose was to convert a "string" to "number" (just like atoi function). My function is:

namespace CP
{
	template < class T >
	T   ToNum(std::string &strNum)
	{
		T num=0;
	
		std::stringstream strm ( strNum );

		strm >> num;

		return num;

	}

}


As you can see above, the function ToNum is present inside a namespace.

In order to use this function in the main program, there are three methods to deal with namespaces. First method is:

using  namespace CP;
std::string strNum=_T("44");
std::cout << ToNum<int>(strNum)


The above method is working fine in which i initially used using namespace CP before anything else.

There is second method which is also working for me. Instead of using using namespace CP, i am directly calling the function ToNum as:

CP::ToNum<int>(strNum)

But the third method is not working for me what i am doing is:

using CP::ToNum;
ToNum<_int64>(strNum);


But strangely it is not working and compiler is giving me horrible STL errors like,

c:\test\test.cpp(32): error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'overloaded-function' (or there is no acceptable conversion)

Please tell me what is the problem ?????
GeneralRe: Namespace and Temmplate function Pin
Brigsoft12-May-03 21:23
Brigsoft12-May-03 21:23 
QuestionHELP! Anyone know MFC here? Pin
Bigsteiny12-May-03 5:55
Bigsteiny12-May-03 5:55 
AnswerRe: HELP! Anyone know MFC here? Pin
Nitron12-May-03 6:03
Nitron12-May-03 6:03 
GeneralRe: HELP! Anyone know MFC here? Pin
Bigsteiny12-May-03 6:09
Bigsteiny12-May-03 6:09 
GeneralRe: HELP! Anyone know MFC here? Pin
David Crow12-May-03 6:54
David Crow12-May-03 6:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.