Ad
  • Custom User Avatar

    What I called a misaligned buffer here is a buffer that doesn't start at the address that its type alignment advertises. For example if a type is aligned at 8, you'd expect it's address to be a multiple of 8. If it isn't, it's misaligned. In the test, I build a buffer that has some arbitrary alignment, then break it to make it start at an incorrect address before calling your function.

  • Custom User Avatar

    I actually changed the prototype in my own solution to const Parameters& after I realized my mistake, but I apparently forgot to change the initial solution. Thank you for pointing it out!

  • Custom User Avatar

    I had std::forward in my initial solution as well but after further reflexion I think it's incorrect. Since we're in a loop every subsequent call to the ctor is moving from objects in an undefined state which is probably not what we want. I could most likely write a test that breaks on such code but I don't think it's within the scope of the kata.

    Thank you for reminding me of destructuring assignment though! I had completely forgotten that it's part of C++ now ^_^