D
DeMarcus
Hi!
I'm stuck in a template. Can anyone see what I'm doing wrong?
template<typename T>
class Foo
{
public:
Foo( T t ) {}
};
class Bar
{
public:
template<typename T>
void add( Foo<T>& foo, T t ) {}
};
int main()
{
Foo<const int> foo( 47 );
Bar b;
b.add( foo, 11 ); // ERROR!
// "No matching function for call to Bar::add(Foo<const int>&, int)"
}
I want the function be Bar::add(Foo<const int>&, const int)
How can I achieve that?
Thanks!
Daniel
I'm stuck in a template. Can anyone see what I'm doing wrong?
template<typename T>
class Foo
{
public:
Foo( T t ) {}
};
class Bar
{
public:
template<typename T>
void add( Foo<T>& foo, T t ) {}
};
int main()
{
Foo<const int> foo( 47 );
Bar b;
b.add( foo, 11 ); // ERROR!
// "No matching function for call to Bar::add(Foo<const int>&, int)"
}
I want the function be Bar::add(Foo<const int>&, const int)
How can I achieve that?
Thanks!
Daniel