Click here to Skip to main content
15,878,048 members

Comments by armagedescu (Top 120 by date)

armagedescu 28-Aug-21 7:43am View    
If is that you say, then it is the difference between i and index_arr[i].
armagedescu 28-Aug-21 7:40am View    
I need to know how exactly OP defines it. I'd like to understand what exactly he expects to see.
armagedescu 28-Aug-21 7:39am View    
How do you prove the indices are not sorted correctly? Provide some exact detail on what is the actual behavior and what is expected behavior in simple words that can help to spot any problem. A short sample of what your code does and that you actually expect, with some explanations.
armagedescu 28-Aug-21 6:05am View    
>>just can't decide on the API
Any API which is standard. Especially any part of STL that is not on experimental is a good choice. That will not impose any special prerequisites and thirdparties to any user which is not you.
>>Still, I want my function to be constexpr. I don't have any problems with implementing
I am curious. Are you using any kind numeric database? Will you make this library public?
armagedescu 27-Aug-21 11:29am View    
>>This question is opinion-based
That's classification on stackoverflow.
>>The easiest solution would be to just return a std::vector of pairs {prime, power}:
no it is not. It is std::map.
>>but I don't want to perform any allocations:
what is exactly the reason for that?
>>I don't want to depend on any external library.
STL is standard library, it is not external. Use any part of STL that is not experimental.
>>I want the function to be constexpr
constexpr doesn't bring any performance improvements unless it can be calculated at compile time. Your problem by definition run time, not compile time. You even should take in consideration dynamic programming.