سؤال

What if i want to set breakpoint into constructor with condition if I == 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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top