1. __STL_STATIC_TEMPLATE_MEMBER_BUG
static member of template classes(模板类静态成员)
template <typename T>
class test{
public:
static int _data;
}
int test<int>::_data=1;
int test<char>::_data=2;
2. __STL_CLASS_PARTIAL_SPECIALIZATION
模板类偏特化,是否支持 partial specialization of class templates
template <class I,class O>
struct test{
test() { cout << "I, O" <<endl; }
};
template <class T>
struct test <T* ,T*> {
test() { cout << "T* ,T*" << endl; }
};
template <class T>
struct test <const T* ,T*> {
test() { cout << "const T* ,T*" << endl; }
};
int main() {
test<int, char> obj1;
test<int*, int*> obj2;
test<const int*, int*> obj3;
}
3. __STL_FUNCTION_TMPL_PARTIAL_ORDER
是否支持partial ordering of function templates
template <class T,class Alloc=alloc>
class vec {
public:
void swap(vec<T, Alloc>&) { cout << "swap1()" << endl; }
};
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
template <class T, class Alloc = alloc>
inline void swap(vec<T, Alloc>& a, vec<T, Alloc>& b) { a.swap(b); }
#endif
int main() {
vec<int> a, b;
swap(a, b);
}
|