My class looks like this, so far.
template< template<int dim, class T> class search_space> class abstract_search_algorithm {
private:
class search_space<dim, class T> & ssp; //error: dim not declared in scope
//public:
// abstract_search_algorithm(search_space<int dim, T>& ss) : ssp(ss) { }
// virtual std::array<T, dim> execute() = 0;
// virtual ~abstract_search_algorithm() { }
};
As you see, the argument to a search_algorithm
will be templated class. Now, I would to store a reference to that class in the agorithm class, but what is the correct type of it?
You may do:
template <typename T> class abstract_search_algorithm;
And specialization:
template<template<int, class> class search_space, int dim, typename T>
class abstract_search_algorithm<search_space<dim, T>> {
// Your implementation.
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.