[OSM-dev] collector.hpp instance creation

Jochen Topf jochen at remote.org
Sat Mar 18 09:03:05 UTC 2017


On Wed, Mar 15, 2017 at 09:42:37PM +0100, Mohamed Abou-Hussein wrote:
> I have a technical problem. I am trying to create a collector
> collector.hpp.
> The typename TCollector vairable, is a class derived from Collector.hpp. So
> I know I have to define a new class that inherits from collector.hpp.
> However, in this class I'll need also to define the typename collector in
> the subclass or I'll just create a the subclass without defining it. But
> then when creating an instance, the problem of specifying the variable type
> would still be there. I am kind of clueless what specifically to do and I
> hope you can help me with that.
> 
> for your ref http://docs.osmcode.org/libosmium/latest/collector_8hpp.html

I answered the same question on IRC already. But here for everybody else
who might stumble across this: This uses CRTP, see here for an
explanation:
https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern

Jochen
-- 
Jochen Topf  jochen at remote.org  https://www.jochentopf.com/  +49-351-31778688



More information about the dev mailing list