Practical Uses for the “Curiously Recurring Template Pattern”

后端 未结 5 1567
孤街浪徒
孤街浪徒 2020-11-30 22:47

What are some practical uses for the \"Curiously Recurring Template Pattern\"? The \"counted class\" example commonly shown just isn\'t a convincing example to me.

5条回答
  •  青春惊慌失措
    2020-11-30 23:22

    Generally it is used for polymorphic-like patterns where you do not need to be able to choose the derived class at runtime, only at compile time. This can save the overhead of the virtual function call at runtime.

提交回复
热议问题