469,291 Members | 1,745 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,291 developers. It's quick & easy.

Template specialization question

I have a function template declared as ff:

template <class T1, class T2>
size_t find( const T1& col, const T2& val, const ColFindEnum& dir ) ;
I wanted to specialize it for string,long as ff:

template<> //string, long specialization
size_t find( const std::string& col, long& val, const ColFindEnum& dir )
However, I get a compiler error:
error C2912: explicit specialization; 'size_t A::find(const std::string
&,long &,const A::ColFindEnum &)' is not a specialization of a function
template

Is it not possible to have a function template that has both template
arguments and arguments with "known types"?


Jul 28 '05 #1
2 1227
Ian
Alfonso Morra wrote:
I have a function template declared as ff:

template <class T1, class T2>
size_t find( const T1& col, const T2& val, const ColFindEnum& dir ) ;
I wanted to specialize it for string,long as ff:

template<> //string, long specialization
size_t find( const std::string& col, long& val, const ColFindEnum& dir )

Missing const on second parameter?

Ian
Jul 28 '05 #2


Ian wrote:
Alfonso Morra wrote:
I have a function template declared as ff:

template <class T1, class T2>
size_t find( const T1& col, const T2& val, const ColFindEnum& dir ) ;
I wanted to specialize it for string,long as ff:

template<> //string, long specialization
size_t find( const std::string& col, long& val, const ColFindEnum& dir )

Missing const on second parameter?

Ian

Thanks - Doh !

Jul 28 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Patrick Kowalzick | last post: by
31 posts views Thread by nikola | last post: by
7 posts views Thread by Siemel Naran | last post: by
5 posts views Thread by Amit | last post: by
6 posts views Thread by merdem | last post: by
6 posts views Thread by abir | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.