The code below compiles fine with vc++.6 but not with vc++.net
the error message is:
..\RegistryArray_demo\RegistryArray\RegArray.h(28): error C3860: template
argument list following class template name must list parameters in the
order used in template parameter list
What does this mean ???
Many thanks in advance.
#ifndef RegArray_h
#define RegArray_h
#include <afxtempl.h>
template <class T, class F>
class CRegArray:public CArray<T, F>
{
public:
CRegArray(const CString sSection, const CString sArrayName);
void FetchRegistry();
void PersistRegistry();
private:
const CString m_sSection;
const CString m_sArrayName;
const CString m_sCounterName;
};
template <class T, class F>
inline CRegArray<T,T&>::CRegArray(const CString sSection, const CString
sArrayName):CArray<T,F>(),
m_sSection(sSection),
m_sArrayName(sArrayName),
m_sCounterName(sArrayName+"_Counter")
{
}
template <class T, class F>
inline void CRegArray<T,T&>::FetchRegistry()
{
int nCounter = AfxGetApp()->GetProfileInt(m_sSection, m_sCounterName, 0);
for(int i = 0; i < nCounter; i++){
CString sElmName;
sElmName.Format("%s %d",m_sArrayName, i);
CString sTmp = AfxGetApp()->GetProfileString(m_sSection, sElmName, "");
CSomeClass clTmp;
clTmp.Parse(sTmp);
Add(clTmp);
}
}
template <class T, class F>
inline void CRegArray<T,T&>::PersistRegistry()
{
AfxGetApp()->WriteProfileInt(m_sSection, m_sCounterName, GetSize() );
for(int i=0;i<GetSize();i++){
CString sElmName;
sElmName.Format("%s %d",m_sArrayName, i);
AfxGetApp()->WriteProfileString(m_sSection, sElmName,
(*this)[i].GetAsString() );
}
}
#endif
Vladimir Nesterovsky - 12 Oct 2004 14:44 GMT
> The code below compiles fine with vc++.6 but not with vc++.net
>
[quoted text clipped - 5 lines]
>
> What does this mean ???
replace
template <class T, class F>
inline CRegArray<T,T&>:: ...
with
template <class T, class F>
inline CRegArray<T,F>:: ...

Signature
Vladimir Nesterovsky
e-mail: vladimir@nesterovsky-bros.com
home: www.nesterovsky-bros.com
Bredal Jensen - 12 Oct 2004 14:59 GMT
Many thanks...
That solved my problem.
By the way. do you know why VS.NET can not locate
<strstrea.h>?
> > The code below compiles fine with vc++.6 but not with vc++.net
> >
[quoted text clipped - 15 lines]
> template <class T, class F>
> inline CRegArray<T,F>:: ...
Carl Daniel [VC++ MVP] - 12 Oct 2004 15:20 GMT
> Many thanks...
>
[quoted text clipped - 3 lines]
>
> <strstrea.h>?
It, along with all "classic IOStreams" headers, was removed from the product
starting with VC7.1 (they were deprecated starting with VC7).
-cd
Vladimir Nesterovsky - 12 Oct 2004 15:26 GMT
> By the way. do you know why VS.NET can not locate
>
> <strstrea.h>?
This are old streams. Use contemporary streams instead.
Please read "Differences in iostream Implementation" topic in MSDN.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_
core_differences_in_iostream_implementation.asp

Signature
Vladimir Nesterovsky
e-mail: vladimir@nesterovsky-bros.com
home: www.nesterovsky-bros.com