never use virtual function for primitives!
why?
they are memory-consuming!
each primitive will contain a table of virtual function pointers, and you will usually have a river of primitives!
so, use virtual function for primitive operator instead! this balance the design and the performance!
treat primitives together as stream,
like this:

class primtive {
};

class primitiveOperator {
public:
virtual void dosomething( void *pointer_to_primitive_array, int num_of_primitives, void *outputs );
...
};

while programming, we can dynamically bind a specified primitive operator to an array of primitives, and the indirect call to the virtual function will only happen once, not one time for each primitive access!


相关文章:

  • 2022-12-23
  • 2021-05-19
  • 2021-08-24
  • 2021-09-07
  • 2021-11-25
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-03
  • 2021-07-03
  • 2022-12-23
  • 2021-12-22
  • 2022-12-23
  • 2021-10-11
相关资源
相似解决方案