Reputation: 5226
I have a tiny question, probably an easy one, but I couldn't found googling it. I am working on some code that has something like that:
Inserter::Inserter(const data::Set& set){
produces<Info>();
}
I don't quite understand what produces means or I am doing something wrong. Here is my interpretation, PLEASE correct me if I am said something wrong:
I had a class Inserter that had an Inserter object, calling from a constant of the object set of class data. Then I produces another object called Info.
am I right?. Please I need some help!!!
Upvotes: 0
Views: 263
Reputation: 121649
Generics :)
Aka "templates"
I had a class Inserter that had an Inserter object, calling from a constant of the object set of class data. Then I produces another object called Info.
Kind of :)
You have a class "Inserter".
It's constructor uses a template class "producer". You instantiate an "Info" kind of "producer".
Here's a good tutorial on templates:
http://www.cplusplus.com/doc/tutorial/templates/
Upvotes: 4
Reputation: 61509
They surround a template type.
produces
is either a function or a class which is templated. The function, or a default constructor, is called.
The specific meaning depends on the implementation. You should read up on how templates work; it is much too involved for a SO answer.
Upvotes: 4