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"? 2 1312
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
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 ! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Patrick Kowalzick |
last post by:
Dear all,
I have a question about default template parameters.
I want to have a second template parameter which as a default parameter,
but depends on the first one (see below). Is something...
|
by: CoolPint |
last post by:
While I was testing my understanding of Functioin Template features by
playing with simple function templates, I got into a problem which I
cannot understand. I would be very grateful if someone...
|
by: Dave |
last post by:
Hello all,
Consider this function template definition:
template<typename T>
void foo(T) {}
If foo is never called, this template will never be instantiated.
Now consider this explicit...
|
by: nikola |
last post by:
Hi all,
I was working with a simple function template to find the min of two values.
But since I would like the two values to be different (type) I dont know
what kind of value (type) it will...
|
by: Siemel Naran |
last post by:
Hi. I have a function
template <class InputIter, class OutputIter>
void f(InputIter begin, InputIter end, OutputIter result);
With c of type char* and cc of type const char*, the code...
|
by: Amit |
last post by:
Greetings all,
I am writing some code somehwat similar to the test code I have below. I am
having a variety of issues with template specialization. I am not sure if
this is related to something...
|
by: Alfonso Morra |
last post by:
if I have a class template declared as ff:
(BTW is this a partial specialization? - I think it is)
template <typename T1, myenum_1 e1=OK, my_enum_2=NONE>
class A {
public:
A();
virtual...
|
by: merdem |
last post by:
Hi all,
I just started to mess around with templates. First I declared a class
Image as follows(this is a small version of the real thing which is
pretty big):
template<int depth, int space,...
|
by: Barry |
last post by:
The following code compiles with VC8
but fails to compiles with Comeau online,
I locate the standard here:
An explicit specialization of any of the following:
|
by: abir |
last post by:
i have a template as shown
template<typename Sclass Indexer{};
i want to have a specialization for std::vector both const & non const
version.
template<typename T,typename Aclass...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |