template specialization in friend function

J

John

I have a class

class x{

public:

template<typename X>
friend X func(X a){
....
}

// I would also want to write the following

template< >
friend double func<double>(double a){
....
}


}


Can someone help on what i am doing wrong?

Thanks,
--j
 
S

shez

John said:
I have a class

class x{

public:

template<typename X>
friend X func(X a){
...
}

// I would also want to write the following

template< >
friend double func<double>(double a){
...
}


}


Can someone help on what i am doing wrong?

Thanks,
--j

If the function definition is inside the class, why does it need to be
a friend?

-shez-
 
J

John

Sorry should have been

class x{

public:

template<typename X>
friend X func(X a);

// I would also want to write the following
template< >
friend double func<double>(double a);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top