[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] Pointere til funktioner i klassen (C++)



Anders Melchiorsen wrote:
Peter Maersk-Moller <sslug@sslug> wrote:
Jeg har et et problem med pointere til funktioner i en klasse.
    u_int32_t (*CVideoFilter::calc_SAD) (uint8_t * , uint8_t * );
[...]
Hvad gør jeg galt her ?
Syntaksen for typen "pointer to member of class X" er X::* ,

u_int32_t (CVideoFilter::* calc_SAD) (uint8_t * , uint8_t * );

Ok. Tak, det giver et bedre resultat.


Nu har jeg så i koden

--------------------------------------------------------------------
class CVideoFilter {

  u_int32_t       (CVideoFilter::* calc_SAD) (uint8_t * , uint8_t * );
};

void CVideoFilter::turn_on_accels(void) {
  if (et-eller-andet)
      calc_SAD    = &CVideoFilter::calc_SAD_noaccel;
}
--------------------------------------------------------------------

og et andet sted har jeg så

--------------------------------------------------------------------
void CVideoFilter::mb_search_44 (uint16_t x, uint16_t y)
{
   ....
  SAD = calc_SAD ( m_denoiser.frame.sub4ref[Yy]+MB_ref_offset,
                   m_denoiser.frame.sub4avg[Yy]+MB_ref_offset );
--------------------------------------------------------------------

men compileren siger så

line 42: must use .* or ->* to call pointer-to-member function in `CVideoFilter::calc_SAD (...)'

Øhh ! Hvad går der galt her ?

I den kode jeg *sakser fra* (transcode - filter yuv-denoiser) går det ellers
fint nok, men der er koden C (og ikk C++) og der bruges ikke klasser
men statiske og globale funktioner/variable, men det burde da ikke
være så svært med klasser, eller gør jeg det bare forkert ?

--PMM

--
+----------------------------------------------------------+
| Se TV over Internettet -- http://www.streamtv.dk/?p=test |
+----------------------------------------------------------+



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:44 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *