Shadowrun: Awakened 29 September 2011 - Build 871
Classes | Functions | Variables
sub_string_finder.cpp File Reference
#include <iostream>
#include <string>
#include <algorithm>
#include "tbb/parallel_for.h"
#include "tbb/blocked_range.h"
Include dependency graph for sub_string_finder.cpp:

Go to the source code of this file.

Classes

class  SubStringFinder

Functions

int main ()

Variables

static const size_t N = 23

Function Documentation

int main ( )

Definition at line 66 of file sub_string_finder.cpp.

References N, and tbb::parallel_for().

           {

  string str[N] = { string("a"), string("b") };
  for (size_t i = 2; i < N; ++i) str[i] = str[i-1]+str[i-2];
  string &to_scan = str[N-1]; 

  size_t *max = new size_t[to_scan.size()];
  size_t *pos = new size_t[to_scan.size()];

  parallel_for(blocked_range<size_t>(0, to_scan.size() ),
               SubStringFinder( to_scan, max, pos ) );

  for (size_t i = 0; i < to_scan.size(); ++i)
    cout << " " << max[i] << "(" << pos[i] << ")" << endl;
  delete[] pos;
  delete[] max;
  return 0;
}

Variable Documentation

const size_t N = 23 [static]

Definition at line 37 of file sub_string_finder.cpp.


Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net