![]() ![]() If there is no virtual function for some cases the virtual function "type_id()" can be used:īool flag = ptr->type_id () = classA::static_type_id () "octave_base_value" has many of these virtual functions like: "is_defined", "is_function". The cost of virtual function is much less than dynamic_cast. This pattern can be replaced by virtual functions. Here no exception is throw in the case of failure. Checking if an object is of some type (or related to some other type by inheritance): It simply can be replaced by static_cast that has no cost.Ģ. This pattern is used dominantly in libinterp/operators/* and some other places. Casting something to other thing (both are related by inheritance):Īn exception may be thrown if the cast (from reference type) isn't successful. Generally dynamic cast has two applications:ġ. So replacing it with alternative solutions potentially improves the overall performance of Octave. It has been proven that dynamic_cast degrades the performance. "dynamic_cast" is present in many places in Octave source. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |