阅读背景:

如何将模板类限制为某些内置类型?

来源:互联网 

This issue has been discussed a few times but all the solutions I have found either didn't work or were based on boost's static assert. My problem is simple. I have a class, and I only want to allow real types (double and float). I want a compile-time error if I try to instantiate the class with a type other than float or double. I am using Visual C++ 11. Here is what I have tried:This issue has been discussed a few times but a




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: