>It would be nice to use templates and constexpr to generate really fast, small code for handling the peripherals.
With only c++11 support, constexpr seems to end up limited (for constexpr functions anyway), unless you are a recursive coding guru.
I am also using c++ for a tiny416-https://github.com/cv007/ATTiny416XplainedNano
where I use templates and it is mostly just a collection of headers.
The big advantage of the templates is you can end up with-
PA0_OUTL_t led; //sets pin mode. output/low is on (4 instructions- pin mode and pin set to 'off')
led.on(); //a single 'sbi 1, 0' (set bit since pin is in invert mode)
The disadvantage when you get into templates, is it 'infects' everything and you end up having to use templates quite often. The advantage, and really the only good option on a limited flash micro like the tiny416 is you end up with small code and you don't get the compiler trying to use pointers all the time, which look sort of ugly on these 8bitters.
With the pic32mm (256K/32K), I started to use templates but then switched to 'normal' coding to keep things simple. It ends up being just fine on a pic32 which can handle pointers/objects with ease. The code is easier to read/change/understand, and any cost is speed is worth it. I do have a reg class template which handles all bit manipulation and register access, but that is the only templates in use for my pic32mm.