Full specialization of a member function template of a class template
From: Dave (better_cs_now_at_yahoo.com)
Date: 05/05/04
- Next message: dru: "Re: What is boost's unspecified_bool_type?"
- Previous message: Julie: "Re: Shell calls without stopping the calling programme"
- Next in thread: Victor Bazarov: "Re: Full specialization of a member function template of a class template"
- Reply: Victor Bazarov: "Re: Full specialization of a member function template of a class template"
- Reply: Buster: "Re: Full specialization of a member function template of a class template"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 4 May 2004 17:21:29 -0700
Hello all,
I am trying to create a full specialization of a member function template of
a class template. I get the following errors:
Line 29: 'foo<T1>::bar' : illegal use of explicit template arguments
Line 29: 'bar' : unable to match function definition to an existing
declaration
What am I doing wrong?
Thanks,
Dave
#include <iostream>
using namespace std;
template <typename T1>
class foo
{
public:
template <typename T2>
void bar(const T2 ¶m);
};
template <typename T1>
template <typename T2>
void foo<T1>::bar(const T2 ¶m)
{
static_cast<void>(param);
cout << "Point 1" << endl;
}
template <typename T1>
template <>
void foo<T1>::bar<double>(const double ¶m)
{
static_cast<void>(param);
cout << "Point 2" << endl;
}
int main()
{
foo<int> var;
var.bar(4.5);
}
- Next message: dru: "Re: What is boost's unspecified_bool_type?"
- Previous message: Julie: "Re: Shell calls without stopping the calling programme"
- Next in thread: Victor Bazarov: "Re: Full specialization of a member function template of a class template"
- Reply: Victor Bazarov: "Re: Full specialization of a member function template of a class template"
- Reply: Buster: "Re: Full specialization of a member function template of a class template"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|