Advertisement
RobertDeMilo

BB3.5 константные объекты в многопоточных программах

Jun 13th, 2024
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.29 KB | None | 0 0
  1. //#include <iostream>
  2. //#include <sstream>
  3. //
  4. //using namespace std;
  5. //
  6. //istringstream line_splitter(line);
  7. //return {istream_iterator<string>(line_splitter),=======}
  8. //
  9. //Stats ExploreLine(const set<string>&key_words,const string&line)
  10. //{
  11. //  Stats result;
  12. //  for (const string& word : Split(line))
  13. //  {
  14. //      if (key_words.count(word) > 0)
  15. //      {
  16. //          result.word_frequencies[word]++;
  17. //      }
  18. //  }
  19.  
  20. //  return result;
  21. //}
  22. //
  23. //
  24. //Stats ExploreKeyWordsSingleThread()
  25. //{
  26. //  result += ExploreLine(key_words, line);
  27. //  return result;
  28. //}
  29. //
  30. //Stats ExploreBatch(const set<string>& key_words, vector<string> lines)
  31. //{
  32. //  Stats result;
  33. //  for (const string& word : lines)
  34. //  {
  35. //     
  36. //      result += ExploreLine(key_words, line);
  37. //     
  38. //  }
  39.  
  40. //  return result;
  41. //}
  42. //
  43. //Stats ExploreKeyWords(const set<string>& key_words, istream& input)
  44. //{
  45. //  const size_t max_batch_size = 5000;
  46. //
  47. //  vector<string> batch;
  48. //  batch.reserve(max_batch_size);
  49. //   
  50. //  vector<future<Stats>> futures;
  51. //
  52. //  for (string line; getline(input, line);)
  53. //  {
  54. //      batch.push_back(move(line));
  55. //      if (batch.size() >= max_batch_size)
  56. //      {
  57. //          futures.push_back(async(ExploreBatch, ref(key_words), move()));
  58. //          batch.reserve(max_batch_size);
  59. //      }
  60. //  }
  61. //}
  62. //
  63. //int main()
  64. //{
  65. //  return 0;
  66. //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement