Using fixed width unsigned integer types like uint8_t, uint16_t, or uint32_t causes a compile-time error.
Example
For instance, using uint8_t as the array data type:
array<uint8_t, 625> points;
And then invoking:
auto cluster_data = dkm::kmeans_lloyd(data, K);
Will throw the following compile-time error:
dkm/include/dkm.hpp: In instantiation of ‘std::tuple<std::vector<std::array<_Tp, _Nm>, std::allocator<std::array<_Tp, _Nm> > >, std::vector<unsigned int, std::allocator<unsigned int> > > dkm::kmeans_lloyd(const std::vector<std::array<_Tp, _Nm> >&, const dkm::clustering_parameters<T>&) [with T = unsigned char; long unsigned int N = 625]’:
dkm/include/dkm.hpp:315:21: required from ‘std::tuple<std::vector<std::array<_Tp, _Nm>, std::allocator<std::array<_Tp, _Nm> > >, std::vector<unsigned int, std::allocator<unsigned int> > > dkm::kmeans_lloyd(const std::vector<std::array<_Tp, _Nm> >&, uint32_t, uint64_t, T) [with T = unsigned char; long unsigned int N = 625; uint32_t = unsigned int; uint64_t = long unsigned int]’
src/main.cpp:148:76: required from here
dkm/include/dkm.hpp:273:2: error: static assertion failed: kmeans_lloyd requires the template parameter T to be a signed arithmetic type (e.g. float, double, int)
static_assert(std::is_arithmetic<T>::value && std::is_signed<T>::value,
^~~~~~~~~~~~~
Description
Using fixed width unsigned integer types like
uint8_t
,uint16_t
, oruint32_t
causes a compile-time error.Example
For instance, using
uint8_t
as the array data type:And then invoking:
Will throw the following compile-time error: