When I've got a template with certain type parameters, is it allowed for a function to return an object of this same template, but with different types? In other words, is the following allowed?
template<class edgeDecor, class vertexDecor, bool dir>
Graph<edgeDecor,int,dir> Graph<edgeDecor,vertexDecor,dir>::Dijkstra(vertex s, bool
print = false) const
{
/* Construct new Graph with apropriate decorators */
Graph<edgeDecor,int,dir> span = new Graph<edgeDecor,int,dir>();
/* ... */
return span;
};
If this is not allowed, how can I accomplish the same kind of thing?