Skip to main content
Code Review

Return to Answer

added 145 characters in body
Source Link
JDługosz
  • 11.7k
  • 19
  • 40

It looks like you know what you’re doing.

One thing I spotted: Don’t write std::iter_swap quallified like that. You have to use ADL to pick up the right version provided for the template arguments. You need the "two step":

using std::iter_swap;
iter_swap (a,b);

just like with regular swap.


You don’t need to qualify your own names when you are in that namespace. Or is that intentional to guard against ADL? I never see that technique used.


Check out Catch2 for beefing up your main into a comprehensive unit test.


generate_vector is missing out on NVRO due to your precondition tests. Declare numbers at the top; always return that.

It looks like you know what you’re doing.

One thing I spotted: Don’t write std::iter_swap quallified like that. You have to use ADL to pick up the right version provided for the template arguments. You need the "two step":

using std::iter_swap;
iter_swap (a,b);

just like with regular swap.


You don’t need to qualify your own names when you are in that namespace. Or is that intentional to guard against ADL? I never see that technique used.


Check out Catch2 for beefing up your main into a comprehensive unit test.

It looks like you know what you’re doing.

One thing I spotted: Don’t write std::iter_swap quallified like that. You have to use ADL to pick up the right version provided for the template arguments. You need the "two step":

using std::iter_swap;
iter_swap (a,b);

just like with regular swap.


You don’t need to qualify your own names when you are in that namespace. Or is that intentional to guard against ADL? I never see that technique used.


Check out Catch2 for beefing up your main into a comprehensive unit test.


generate_vector is missing out on NVRO due to your precondition tests. Declare numbers at the top; always return that.

Source Link
JDługosz
  • 11.7k
  • 19
  • 40

It looks like you know what you’re doing.

One thing I spotted: Don’t write std::iter_swap quallified like that. You have to use ADL to pick up the right version provided for the template arguments. You need the "two step":

using std::iter_swap;
iter_swap (a,b);

just like with regular swap.


You don’t need to qualify your own names when you are in that namespace. Or is that intentional to guard against ADL? I never see that technique used.


Check out Catch2 for beefing up your main into a comprehensive unit test.

lang-cpp

AltStyle によって変換されたページ (->オリジナル) /