Skip to main content
Code Review

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

I didn't check everything yet but here are already some remarks:

  1. Your example lacks the include of <string> so it doesn't compile this way.
    Pretty obviously a copy and paste problem ;-)
  2. Use the same types in for loops.
    Currently you are comparing int i against the size_t return value of string::size().

    e.g. for (int i = 0; i < letters.size(); ++i) should be for (size_t i = 0; i < letters.size(); ++i)

    This might not look like a big deal but it will prevent you from unwanted or undefined behaviour unwanted or undefined behaviour.
  3. The last parameter of getLetterCombos could be passed as const reference instead of copying the value on every call.

I didn't check everything yet but here are already some remarks:

  1. Your example lacks the include of <string> so it doesn't compile this way.
    Pretty obviously a copy and paste problem ;-)
  2. Use the same types in for loops.
    Currently you are comparing int i against the size_t return value of string::size().

    e.g. for (int i = 0; i < letters.size(); ++i) should be for (size_t i = 0; i < letters.size(); ++i)

    This might not look like a big deal but it will prevent you from unwanted or undefined behaviour.
  3. The last parameter of getLetterCombos could be passed as const reference instead of copying the value on every call.

I didn't check everything yet but here are already some remarks:

  1. Your example lacks the include of <string> so it doesn't compile this way.
    Pretty obviously a copy and paste problem ;-)
  2. Use the same types in for loops.
    Currently you are comparing int i against the size_t return value of string::size().

    e.g. for (int i = 0; i < letters.size(); ++i) should be for (size_t i = 0; i < letters.size(); ++i)

    This might not look like a big deal but it will prevent you from unwanted or undefined behaviour.
  3. The last parameter of getLetterCombos could be passed as const reference instead of copying the value on every call.
Source Link

I didn't check everything yet but here are already some remarks:

  1. Your example lacks the include of <string> so it doesn't compile this way.
    Pretty obviously a copy and paste problem ;-)
  2. Use the same types in for loops.
    Currently you are comparing int i against the size_t return value of string::size().

    e.g. for (int i = 0; i < letters.size(); ++i) should be for (size_t i = 0; i < letters.size(); ++i)

    This might not look like a big deal but it will prevent you from unwanted or undefined behaviour.
  3. The last parameter of getLetterCombos could be passed as const reference instead of copying the value on every call.
lang-cpp

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