An alternative Serial Library for Arduino 1.0

I suppose that the most controversial issue at this point is whether the users should be exposed to template syntax.

How about:

#define USE_SERIAL SerialPort<0, 64, 64> NewSerial
#define USE_SERIAL1 SerialPort<1, 64, 64> NewSerial1
#define USE_SERIAL2 SerialPort<2, 64, 64> NewSerial2
#define USE_SERIAL3 SerialPort<3, 64, 64> NewSerial3

A hypothetical wholescale replacement of HardwareSerial.h could have:

#if !defined(__SerialPortAlreadyLoaded__)
#include <SerialPort.h>
USE_SERIAL;
#if defined(UBRR1H)
USE_SERIAL1;
#endif
#if defined(UBRR2H)
USE_SERIAL2;
#endif
#if defined(UBRR3H)
USE_SERIAL3;
#endif
#endif

and wind up approximately where the defaults are today.
if the user had already set up a different SerialPort structure, that would be used instead.

Is there something that guarantees that the static arrays used for the usartRegister class don't end up in your actual image? I noticed a while ago that uart registers had a fixed layout and common constants, and set them up as an overlaid structure, with similar savings in execution time. (and special cases need for ATmega8) This looks more general; I'm still looking for a downside...

Do you have a tutorial on templates that you like? When do they usually show up, in the course of learning C++?