Boost logo

Boost Users :

From: Shishir Ramam (sramam_at_[hidden])
Date: 2005-08-01 13:44:52


Hello fellow boosters!

I am looking to use boost:any.

While gaining an understanding of how to use it, it strikes
me that the real purpose it serves is that the virtual table
functionality is exposed to the user. It seems that efficiency
of table lookup are then the application responsibility.

My first question - Is this a reasonable understanding?

I have been looking to see if tag dispatching can somehow
circumvent the cost of table lookup that would be necessary,
and the only thing that strikes me is to
- store a type id within the type boost::any represents,
- retrieve this id and either use it in an if/else structure, or
  a function pointer lookup in an array. A complete tag
  dispatch implementation seems impossible, since
  the type id within the boost::any structure is a run time
  quantity.

My second question - Are there better ways to do it than an
index into an array of functions?

TIA.
-shishir

-- 
It is not because things are difficult that we do not dare, 
it is because we do not dare that things are difficult. 
 - Seneca

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net