本文整理汇总了C++中TStack::sort_parallel方法的典型用法代码示例。如果您正苦于以下问题:C++ TStack::sort_parallel方法的具体用法?C++ TStack::sort_parallel怎么用?C++ TStack::sort_parallel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TStack
的用法示例。
在下文中一共展示了TStack::sort_parallel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
PrintStars();
break;
}
if (fig == 3)
{
stack.push(shared_ptr<Figure>(new Rectangle(cin)));
PrintStars();
break;
}
if (fig == 0)
{
state = start;
PrintStars();
break;
}
cout << "Wrong number" << endl;
PrintStars();
break;
}
case del:
{
PrintStars();
stack.pop();
PrintStars();
state = start;
break;
}
case print:
{
PrintStars();
for (auto i : stack)
i->Print();
PrintStars();
state = start;
break;
}
case srt:
{
clock_t time;
double duration;
time = clock();
cout << "Sort -------------" << endl;
stack.sort();
cout << "Done -------------" << endl;
duration = (clock() - time) / (double)CLOCKS_PER_SEC;
cout << "Time of sort: " << duration << endl;
state = start;
break;
}
case par_sort:
{
clock_t time;
double duration;
time = clock();
cout << "Parallel Sort ----" << endl;
stack.sort_parallel();
cout << "Done -------------" << endl;
duration = (clock() - time) / (double)CLOCKS_PER_SEC;
cout << "Time of parallel sort: " << duration << endl;
state = start;
break;
}
case fin:
return 0;
}
}
/*TStack<Figure> stack;
std::default_random_engine generator;
uniform_int_distribution<int> distribution(1, 14);
for (int i = 0; i < 14; i++) {
int side = distribution(generator);
stack.push(shared_ptr<Figure>(new Triangle(side, side, side)));
stack.push(shared_ptr<Figure>(new Quadro(side)));
stack.push(shared_ptr<Figure>(new Rectangle(side, side + 1)));
}
TStack<Figure> stack1 = stack;
std::cout << "Sort -------------" << std::endl;
stack1.sort();
stack.sort_parallel();
std::cout << "Done -------------" << std::endl;
std::cout << stack << std::endl;
std::cout << stack1 << std::endl;*/
}