Solved

How to make a template class a friend?

Posted on 2006-07-10
1
269 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 125 total points
ID: 17071129
Hi mikrodidakt,
You can not.
It's not allowed by the C++ standards.

Cheers!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
c++ class logger 6 103
eclipse error 7 86
How can I get Delphi 6 component ShellShock working? 4 80
VS can't find System.IO.Packaging 5 350
In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now