Is there some standard C++ traits class we can use to do these methods in a templatized or otherwise more DRY way?