Click here to Skip to main content
15,888,008 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
GeneralRe: HELP! Anyone know MFC here? Pin
Bigsteiny12-May-03 16:20
Bigsteiny12-May-03 16:20 
GeneralRe: HELP! Anyone know MFC here? Pin
David Crow13-May-03 2:12
David Crow13-May-03 2:12 
AnswerRe: HELP! Anyone know MFC here? Pin
Toni7812-May-03 7:21
Toni7812-May-03 7:21 
GeneralRe: HELP! Anyone know MFC here? Pin
Bigsteiny12-May-03 16:18
Bigsteiny12-May-03 16:18 
AnswerRe: HELP! Anyone know MFC here? Pin
Roger Allen13-May-03 1:04
Roger Allen13-May-03 1:04 
Generalsigh. still not working. Pin
Bigsteiny13-May-03 16:48
Bigsteiny13-May-03 16:48 
GeneralRe: sigh. still not working. Pin
MAAK13-May-03 22:02
MAAK13-May-03 22:02 
GeneralRe: sigh. still not working. Pin
MAAK13-May-03 22:07
MAAK13-May-03 22:07 
GeneralGot it! Pin
Bigsteiny14-May-03 16:18
Bigsteiny14-May-03 16:18 
GeneralAdding to dialogue design palette Pin
Trollslayer12-May-03 5:31
mentorTrollslayer12-May-03 5:31 
GeneralRe: Adding to dialogue design palette Pin
G. Steudtel12-May-03 6:05
G. Steudtel12-May-03 6:05 
QuestionTLB's need to be registered ?? Pin
Braulio Dez12-May-03 5:28
Braulio Dez12-May-03 5:28 

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.