I cannot say that I have ever used it myself, but check out the Boost Concept Check library. Apparently it was slated for inclusion into C++11, but was eventually abandoned or postponed.