Можно ли использовать std :: make_unique с абстрактным интерфейсом?

Менее умный, более очевидный для всех-программистов метод вашей команды.

#include <cctype>

int CountWords(const char* str)
{
   if (str == NULL)
      return error_condition;  // let the requirements define this...

   bool inSpaces = true;
   int numWords = 0;

   while (*str != NULL)
   {
      if (std::isspace(*str))
      {
         inSpaces = true;
      }
      else if (inSpaces)
      {
         numWords++;
         inSpaces = false;
      }

      ++str;
   }

   return numWords;
}
10
задан Boris 14 October 2014 в 07:53
поделиться