====== 2011.04.08 - template overloading for array types ====== yesterday Mariusz, a friend from my [[http://www.wcss.wroc.pl|current work]], showed me a short article describing interesting feature of [[wp>C++]] -- template overloading for array types. it's very nice thing, since you can easily tell smart pointer if argument it takes is a pointer to some object or array of objects (i.e. "new X" or "new X[10]", that both are pointer to by "X*"). for example consider the following code: #include using namespace std; template struct Test { static void f(void) { cout<<"Test"< struct Test { static void f(void) { cout<<"Test"<::f(); Test::f(); return 0; } output on the screen is be: Test Test another interesting fact is that it is actually used in [[wp>C++0x]] standard library implementation of std::unique_ptr<>, to use "delete" for object pointers and "delete[]" for array-of-objects pointers.