C++ generic make factory