I can't be the first person to ask this, so I'm figuring there has got to be some solution. I have a template class that will sometimes be passed an array and other times not. Taking care of assigning for either case is the easy part: memcpy(). The hard part is trying to generically print (via ostream) for both cases.
E.g.,
Code:
template <typename T>
class Foo {
  T data;// type_info::name() could be "int", "char[14]", etc
public:
  // ...
  friend std::ostream& operator<<(std::ostream &out, const Foo &foo) {
    if (its_an_array)// ignore this; I determine this in the constructor
      for (int i = 0; i < count; ++i)// print each array element individually
        out << data[i];// ==> error when T is not an array type <==
    else
      out << data;// print an individual variable
    return out;
  }
};