
Thomas Suckow wrote:
Christoph Mathys wrote:
void someFunc(boost::uint16_t) { } void someFunc(boost::uint32_t) { } void someFunc(std::size_t) { }
Not sure if you are optimizing for 16bit and 32bit.
It is actually code handling some endianness stuff.
Wouldn't a template function be appropriate here?
Maybe a template function would be more appropriate, avoiding possibly dangerous conversions by putting a static assert into the default implementation. But I'd still have to provide specializations for uint32_t and unsigned long or uint32_t and unsigned int, depending on the platform. Ideally, I'd like to work only with those fixed width integers if I need to provide an implementation for every integer type, avoiding code noise with ifdef and co. Christoph