RE: [ROOT] Pointer to member problem.

From: Philippe Canal (pcanal@fnal.gov)
Date: Mon Feb 09 2004 - 18:59:39 MET


Hi,

This is a limitation in CINT.
You can work around the problem by using a typedef:

lass LJets;
typedef Bool_t (LJets::* LJetsMem)(Int_t);

class Cut {
public:
   Cut() {};
   void Cut2(LJetsMem) {}
};

Cheers,
Philippe.
-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Ricardo Eusebi
Sent: Saturday, February 07, 2004 9:14 PM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] Pointer to member problem.


Hi,
I'm running Root  Version   3.05/04 on a Linux  2.4.20-24.7s  machine.
I'm trying to make a class(Cut)  that will be fed with  the pointer to 
another class' method. This class will later execute the other class 
method and keep track of statistics.
At compiling time  I'm getting an error I can't get around.
The  class follows

class LJets;
class Cut {

 public :
    Cut() { /* default Ctor */ };
    void  Cut2(Bool_t (LJets::*Member)(Int_t));

    // Classdef ID 0 because I don't input output
    ClassDef(Cut,0)
};

ClassImp(Cut)
void Cut::Cut2(Bool_t(LJets::*Member)(Int_t))  { /* nothing for now */ }


When compiling I get :
root [0] .L ~/root_macros/LJets/Cut.h++
Info in <TUnixSystem::ACLiC>: creating shared library 
/home/people/eusebi/root_macros/LJets/Cut_h.so
"/home/people/eusebi/root_macros/LJets/fileZuTOLg.cxx", line 229: error 
#167:
          argument of type "Bool_t (*)(Int_t)" is incompatible with 
parameter
          of type "Bool_t (LJets::*)(Int_t)"
        ((Cut*)(G__getstructoffset()))->Cut2((Bool_t 
(*)(Int_t))G__int(libp->para[0]));

What does it mean ?
Can I get around this in root ??

Thanks in advance,

Ricardo

-- 
  --------------------------------------------------------------------
| Ricardo Eusebi                |   Office :  CDF trailer 168-"O"    |
| High Energy Physics           |   Phone  : (630) 840 8622          |
| University of Rochester       |   email  : eusebi@fnal.gov         |
  --------------------------------------------------------------------
|               Fermi National Accelerator Laboratory                |
|                    CDF - MS318 .  PO Box 500                       |
|                     Batavia 60510, Illinois.                       |
  --------------------------------------------------------------------



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:05 MET