I'd like to create function that creates different types of generators (own classes) and I go with something like this:
template <typename Iterator>
class Generator {
Iterator begin_;
Iterator end_;
public:
Generator(Iterator begin, Iterator end)
: begin_(begin)
, end_(end)
{}
};
template <typename GeneratorType, typename ContainerIterator>
GeneratorType<ContainerIterator> make_generator(ContainerIterator begin, ContainerIterator end){ // Error occurs here
return GeneratorType<ContainerIterator>(std::forward<ContainerIterator>(begin), std::forward<ContainerIterator>(end));
}
But it's not compiling since error:
error: 'GeneratorType' is not a template (in line GeneratorType<ContainerIterator> make_generator...)
Do anyone know if it is possible and if yes how to fix it?
Aucun commentaire:
Enregistrer un commentaire