Q:

Does iostream use overloads or templates?

I'm trying to make the write() system call a little easier for my class. It won't take the 
destination and size parameters, but instead, only the object. Templates seem the best solution, but I've got some troubles when dealing with arrays, e.g.
The C++ I/O functions had to manage this situation as well, then I'd like to know how they were implemented. We don't care that for the compiler templates and overloads are basically the same thing.
I will also overload the << operator, to sweeten the syntax make it even easier to use.
How the function should work like
The member function should let you send data to a certain fd. It should look like so:
string s = "Hello World!";
double array[10];
int s = 50;
send(s); 
send(array);
send(s);

For the strings, I've overloaded the function just for const char* and it works (strlen is much better than sizeof in that case).

A:

IOStreams don't have any overloads dealing with arrays. The streams can deal with C-style strings, i.e., a pointers to a null-character terminated sequences of char (or wchar_t when using wide character streams). That said you can deduce the size of a statically sized array in C++:
template <typename T, std::size_t Size>
void print_size(T (&array)[Size]) {
    std::cout << "size=" << Size << '\n';
}

Note, however, that I don't consider it a good idea to use template like the above to determine the amount of memory which needs to be written: just writing the bytes constituting an object clearly only works for PODs and even then it is a bad idea because there are fairly few guarantees about the layout of the objects. You are always better of properly serializing the objects where the serialized representation may be a binary representation which is pretty close to the way objects are [currently] represented in memory. However, specifying exactly how the data is serialized has benefits, e.g., when the data needs to be transferred between platform. Sure, that will never happen - until it does: if the software is any good, transferring data between system will be necessary.
The other realization is that plain arrays are actually quite uncommon. Instead, different containers are being used. To serialize them immediately what is really needed is a range abstraction with arrays just becoming a special kind of array.

