Template for C++ version