Реализации на С++
Strategy
Общая реализация на языке С++
class Strategy
{
public:
virtual void algorithmSort(shared_ptr<double[]> ar, unsigned cnt) = 0;
};
# include <iostream>
# include <memory>
# include <initializer_list>
using namespace std;
void main()
{
using TStrategy = BustStrategy<Comparison<double>>;
shared_ptr<Strategy> strategy = make_shared<TStrategy>();
Array ar{ 8., 6., 4., 3., 2., 7., 1. };
ar.sort(strategy);
cout << ar << endl;
}
Last updated
Was this helpful?