OK, this is my first foray into templates, and this will likely be the first of several very silly, simple questions.
Consider:
template <class T>
void sendit(char *buffer, unsigned len)
{
// force compile error
}
void sendit<first_valid>(char *buffer, unsigned len)
{
// this is OK
}
void sendit<second_valid>(char *buffer, unsigned len)
{
// this is OK
}
Basically, the idea is that I have a set of "things" that may legally be operated on by the sendit() procedure, and I will specialize the template for those things. If a user tries to call sendit(), (OK, technically, sendit()), I want to throw a compilation error in his face.
Is this do-able? If so, how?
Is this a reasonable approach?