C++中怎么将模板函数的具体模板类型转成字符串


class IService
{
public:
    // ...
};

class MyClass
{
public:
};

#define ASSERT_SERVICE(_ServiceName_) \
static_assert(std::is_base_of<IService, _ServiceName_>::value, #_ServiceName_"不是继承自IService")

class ApplicationContext
{
public:
    // ...

    template<class ServiceType>
    static void registerService()
    {
        ASSERT_SERVICE(ServiceType);

        // ...
    }

    // ...
};

我在registerService中使用了ASSERT_SERVICE,调用时:

ApplicationContext::registerService<MyClass>();

希望能将具体的类型转成字符串,就是这一句:#ServiceName"不是继承自IService" 可以转成 “MyClass不是继承自IService”,但是断言结果是:

error C2338: ServiceType

VS2019对宏的展开:

img

并没有将MyClass转成字符串,而是把声明的模板类型转成了字符串,我要怎么做才可以将具体的类型转字符串?