Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to make a template class a friend?

Posted on 2006-07-10
1
Medium Priority
?
282 Views
Last Modified: 2013-11-17
template<class T> struct plotvalue : public std::unary_function<T, void>
{
  plotvalue(//GraphHandler& g) : gh(g) {}
  void operator() (T x) {
        if(x.Param_code == 0x00000002) {
                double time = (x.Time - gh.start_time)/60;
                gh.series.AddXY(time, x.Measure_Value);
         }
  }
  GraphHandler& gh;
};
//---------------------------------------------------------------------------
class GraphHandler {
        friend template<class T> struct plotvalue : public std::unary_function<T, void>
        public:
                GraphHandler(TCustomSeries& s, TChart& c, TChartEditor& ce);
                void plot(MessageHandler& mh, TCustomSeries* series);
        private:
                bool first_time;
                TCustomSeries& series;
                TChart& chart;
                TChartEditor& chartEditor;
                unsigned __int32 start_time;
};

because this dose't work? Or is it even possible?
0
Comment
Question by:mikrodidakt
1 Comment
 
LVL 30

Accepted Solution

by:
Axter earned 375 total points
ID: 17071129
Hi mikrodidakt,
You can not.
It's not allowed by the C++ standards.

Cheers!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question