Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: a question about speed difference that I do not understand

Author: Gerd Isenberg

Date: 07:20:37 12/06/01

Go up one level in this thread


In C++ it's also possible to make indirect calls with pointers to
member-functions. "->*" or ".*" are special C++ operators to call
member-functions via pointer or reference. Therefore inside the class "this->*"
is required.


class CNode
{
  ...
  typedef BitBoard (CNode::*PTR_GETATTACK)(unsigned int sq) const;
  static PTR_GETATTACK m_scPieceAtta[14];

  __forceinline BitBoard GetAttack(unsigned int sq, unsigned int piece) const
  {
    return (this->*m_scPieceAtta[piece])(sq);
  }
  BitBoard AssertAttack(unsigned int sq) const;
  ...
};

CNode::PTR_GETATTACK CNode::m_scPieceAtta[14] =
{
  AssertAttack,
  ...
};



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.