On Dec 11, 2007 1:03 PM, Robert Dailey
template< typename T > struct default_alpha;
template<> struct default_alpha<float> { static const float value = 1.0f; // Note that this is not legal. I'm simply just presenting pseudo code.
};
template<> struct default_alpha<unsigned char> { static const unsigned char value = 255; };
template< typename T > class Color { Color( T r, T g, T b, T a = default_alpha<T>::value ); };
So why not use Jeff Flinn's suggestion: template< typename T > struct default_alpha; template<> struct default_alpha<float> { static float value() { return 1.0f; } }; template<> struct default_alpha<unsigned char> { static unsigned char value() { return 255; } }; template< typename T > class Color { public: Color( T r, T g, T b, T a = default_alpha<T>::value() ); }; ...? Stjepan