This started out when I noticed a potential pitfall in the API of SetCallback where you could potentially get the class into a bad state. Ultimately I wasn't able to fix that in this patch, although I did include a comment in this patch explaining the problem and some possible fixes. But my initial attempts to fix it before I decided that the best approach wasn't clear ended up in this patch, which I think is still a net positive, so I'm uploading it anyway.
Basically, it makes the Baton classes a little bit more type-safe by plumbing unique_ptrs through a few more places so that you never have to deal with raw pointers, and it also makes it so Batons can clean up after themselves by default, so anyone implementing a new baton doesn't have to reimplement the exact same code in the destructor every time.
Also fixes a compiler error since SIZE_T_MAX isn't defined.