June 02, 2006
Fixing the Plumbing
Many professions can enjoy the tremendous benefits of standardization. Take plumbers, for instance. It's got to be reassuring to be able to go into a hardware store and buy a 3/8" pipe fitting knowing that it will fit your 3/8" pipe.
Programmers aren't so lucky. Well, occasionally programmers are that lucky. But most of the time, things don't fit together without some pain. Stephen Hutton shows us a good way to handle one of those "plumbing" problems—type conversion—in his article "Supporting Custom C++ Types." To do it, he uses a traits class, which is a class template that contains only typedefs and static functions.
Posted by Kevin Carlson at 12:50 PM Permalink
|