Multiple dispatch

  • Thread starter Leslaw Bieniasz
  • Start date
L

Leslaw Bieniasz

Hello,

I need to implement multimethods in my program.
Can anybody point me to the literature or other
discussions of the most efficient algorithms of
performing multiple dispatch in C++?
Please DO NOT DIRECT ME to the existing libraries
that provide support for multimethods. I need
a public domain ALGORITHM or CODE that I can freely
adapt to my needs.

L.B.

*-------------------------------------------------------------------*
| Dr. Leslaw Bieniasz, |
| Institute of Physical Chemistry of the Polish Academy of Sciences,|
| Department of Electrochemical Oxidation of Gaseous Fuels, |
| ul. Zagrody 13, 30-318 Cracow, Poland. |
| tel./fax: +48 (12) 266-03-41 |
| E-mail: (e-mail address removed) |
*-------------------------------------------------------------------*
| Interested in Computational Electrochemistry? |
| Visit my web site: http://www.cyf-kr.edu.pl/~nbbienia |
*-------------------------------------------------------------------*
 
V

v4vijayakumar

if you can implement your _program_ with multimethods then choose the
appropriate language that supports it. propably, CLOS (Common Lisp
Object System)
 
K

kowalzick

Hello,
I need to implement multimethods in my program.
Can anybody point me to the literature or other
discussions of the most efficient algorithms of
performing multiple dispatch in C++?
Please DO NOT DIRECT ME to the existing libraries
that provide support for multimethods. I need
a public domain ALGORITHM or CODE that I can freely
adapt to my needs.

There is a nice chapter in "Modern C++ Design" from Andrei
Alexandrescu.

Regards,
Patrick
 
D

Diego Martins

More Effective C++ has a good case study too. Read it before getting
Alexandrescu's
 
W

wkaras

Leslaw said:
Hello,

I need to implement multimethods in my program.
Can anybody point me to the literature or other
discussions of the most efficient algorithms of
performing multiple dispatch in C++?
Please DO NOT DIRECT ME to the existing libraries
that provide support for multimethods. I need
a public domain ALGORITHM or CODE that I can freely
adapt to my needs.

L.B.

Here's some example code. I'm not sure it's anything like
what you have in mind.

struct A
{
virtual void funcB(B &b) = 0;
};

struct A1 : public A
{
virtual void funcB(B &b) { b.funcA1(*this); }
};

struct A2 : public A
{
virtual void funcB(B &b) { b.funcA2(*this); }
};

struct B
{
virtual void funcA1(A1 &a) = 0;
virtual void funcA2(A2 &a) = 0;
};

struct B1 : public B
{
virtual void funcA1(A1 &a);
virtual void funcA2(A2 &a);
};

struct B2 : public B
{
virtual void funcA1(A1 &a);
virtual void funcA2(A2 &a);
};

void foo(A &a, B &b)
{
// Calls appropriate Bx::funcAx() .
a.funcB(b);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top