
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
participants (1)
-
Shishir Ramam