Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Consider storing the user's answers in
constexpr
variables then using the regularAssert::That
syntax instead ofstatic_assert
s. This way, the program still checks compile time behavior, but can still compile and provide meaningful feedback (viaExtraMessage
) instead of just refusing to compile and giving a vague assertion failure message.It's a variable template. In this particular case, making it not a function probably forces more creative solutions
An answer two years too late, but your code returns the incorrect result when T is
unsigned
. Thevs
function is where the problem lies.This comment is hidden because it contains spoiler information about the solution
Finally got it.
This is a great kata, offering insights into underrepresented aspects of kata, hardly seen on Code Wars.
Things that might help in the description:
Determined to figure it out to give it an up vote!
Loving the introduction to templates - it is inspiring a great deal of research to figure out. Any brief overview of what the given code means would go a long way int the project description.
Thanks for providing a rarely-showcased aspect of programming.
Good question. Can't find any examples online of similar code that uses exactly this syntax.
I made this kata, and this looks a lot like my solution.
Did you somehow base this on mine? Or were you forced to do so due to some weird edge cases that require exactly this solution (since I compare results to mine)?
If this came to you naturally, then I guess the description and tests work as intended, but since it is too similar I am not sure if there is a mistake on my side. If so I'd like to improve it. If I have the time for it I might try to remove my reference solution from the tests altogether to avoid any chance of this issue.
Any other feedback (and rating) is also welcome.
Thanks!
EDIT: After having a second look, it seems to contain the same bug that my solution had initially. Wasn't an issue due to relatively low precision requirements, but I guess that answers my question.
Why is
seq_max_v
not a function? Is it designed this way specifically for the challenge?