简体   繁体   English

模板中特定模板参数的断点

[英]breakpoint in template for specific template parameter

What if i want to set breakpoint into constructor with condition if I == 10? 如果我想在条件== 10的情况下将断点设置为构造函数怎么办?

template < typename T, int I >
class C 
{
public:

    C<T, I>() { cout << I << endl; }
};

If conditional break point does not work try 如果条件断点不起作用,请尝试

template < typename T, int I >
class C 
{
public:

    C() 
    {
       if(I == 10)
       {
*         int a= 0; //or try __debugbreak();
       }
       cout << I << endl;
    }
};

EDIT To break on specific class you may use std::is_same<T, U>::value (or boost analogue) in condition 编辑要打破特定的类,您可以在条件下使用std::is_same<T, U>::value (或boost模拟)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM