typedef double T1;
typedef add_const<T1>::type T2;
T2 x = 3.14;
bool b1 = is_const<T2>::value;
typedef double T3[4];
typedef add_const<T3>::type T4;
T4 a = {1,2,3,4};
bool b2 = is_const<T4>::value;
bool b4 = is_const<T3>::value;
int main()
{
cout << "type T2: " << typeid(T2).name() << endl;
cout << "type T4: " << typeid(T4).name() << endl;
cout << "b1: " << b1 << endl; //true
cout << "b2: " << b2 << endl; //true
return (0);
}
-------
qualifiers applied to a reference are ignored
tricky const with typeid.
-------
undefined template type : C++ Meta P.171
class<>-------
There's NO partial template friendship!
-------
Bad coding style:
1. Lack of non-virtual protected destructor in (empty) base class
2. implementing cast operators
operator T() const3.Declaring a non-explicit constructor with a singl argument.
------
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.