skarupke/ska_sort

vs2015: class template has already been defined

Opened this issue · 0 comments

I tried to use this library on a custom type, but it always fails to compile with the listed error.

Here is my radix sort key function:

uint64_t to_radix_sort_key(const Command & c){
return c.Key().FullKey();
}

And the call to ska_sort

ska_sort(commands.begin(), commands.end());

And full error:

ska_sort.hpp(1017): error C2953: 'detail::FallbackSubKey<T,std::enable_if<!std::is_same<void,unknown-type>::value,void>::type>': class template has already been defined
ska_sort.hpp(846): note: see declaration of 'detail::FallbackSubKey<T,std::enable_if<!std::is_same<void,unknown-type>::value,void>::type>'

If I remove one of these overloads, it does compile, but I see no speedup over std::sort, in fact they appear to have the same runtime so I suspect it is falling back to std::sort.

EDIT: I just tried sorting other data, such as a std::vector<uint32_t>, which I would think would not require a custom sort, and it produces the exact same error.

Rather baffled as to how anyone is using this library, is this a VS2015 specific error?

I tried benchmarking ska_sort with various types(u32,float,u64) and I am not seeing any speed up, it always runs in the same time as std::sort, I believe there may be some issue with how this library works in VS2015(possibly caused by the fact that I had to comment out one of those overloads to get anything to compile).