using templates: how can i do a parameter for accept a function name?
cambalinho
125
Practically a Posting Shark
Recommended Answers
Jump to PostI'm afraid your question is too unclear. Please give an example of what you would like to achieve.
Jump to PostDo you mean something like this?
template <typename T> double func1(const T & f, double x) { return f(x); } double square(double x) { return x*x; } struct cube { double operator()(double x) const { return x*x*x; } }; int main() { double x = 2; …
All 6 Replies
mike_2000_17
2,669
21st Century Viking
Team Colleague
Featured Poster
cambalinho
125
Practically a Posting Shark
steak-sandwich
0
Newbie Poster
cambalinho
125
Practically a Posting Shark
cambalinho
125
Practically a Posting Shark
cambalinho
125
Practically a Posting Shark
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.