F
Fred Zwarts
I have created a template function for a generic algorithm.
For unsigned integer types, a small modification in the algorithm is needed,
because I can't use negative values there.
So, I want to make specializations for all unsigned integer types.
I assume that it is not possible in C++ to write one specialization for all
unsigned integer type, but that a specialization for each unsigned integer type
must be created.
Since this software runs on different platforms, I wonder whether it is
possible to write a complete set of specializations in a platform independent way.
I first tried to write specializations for uint8_t, uint16_t, uint32_t and uint64_t
as defined in inttypes.h, but it turns out that on some platforms some
unsigned integer types are still missing. (Under Windows e.g.,
there is more than one 32-bit unsigned integer type.)
Types like size_t and clock_t map to different types on different platforms.
I wonder whether it is possible to create a complete list,
without using conditional code selection in the preprocessor.
Is the list "unsigned char, unsigned short, unsigned int, unsigned long and unsigned long long"
complete and without overlap (as far as specializations concern) for all platforms?
Should I add unsigned wchar_t, or is it covered already?
(I know that char needs special attention. I know how to handle that case.)
For unsigned integer types, a small modification in the algorithm is needed,
because I can't use negative values there.
So, I want to make specializations for all unsigned integer types.
I assume that it is not possible in C++ to write one specialization for all
unsigned integer type, but that a specialization for each unsigned integer type
must be created.
Since this software runs on different platforms, I wonder whether it is
possible to write a complete set of specializations in a platform independent way.
I first tried to write specializations for uint8_t, uint16_t, uint32_t and uint64_t
as defined in inttypes.h, but it turns out that on some platforms some
unsigned integer types are still missing. (Under Windows e.g.,
there is more than one 32-bit unsigned integer type.)
Types like size_t and clock_t map to different types on different platforms.
I wonder whether it is possible to create a complete list,
without using conditional code selection in the preprocessor.
Is the list "unsigned char, unsigned short, unsigned int, unsigned long and unsigned long long"
complete and without overlap (as far as specializations concern) for all platforms?
Should I add unsigned wchar_t, or is it covered already?
(I know that char needs special attention. I know how to handle that case.)