Can I separate creation and usage locations of compile-time strategies?

前端 未结 2 1503
慢半拍i
慢半拍i 2021-01-06 11:00
#include 
#include 
#include 
#include 

using namespace std;

struct SubAlgorithm1 { void operator ()          


        
2条回答
  •  不知归路
    2021-01-06 11:43

    You should use an interface, with both SubAlgorithm1 and SubAlgorithm2 (you'll need better names than that) implementing the interface. The create an object of either class depending on runtime_flag.

提交回复
热议问题