Hi,

 

I installed Boost 1.58.0 today, having been using 1.57.0 previously, and noticed that a part of my code that uses boost::factory doesn’t compile anymore. Here’s briefly what I’m doing, followed by the error message I’m getting:

 

typedef boost::function<Apollo::ReportGenerator*(Apollo::ApolloBaseModel*)> reportFactory;

           

struct reportListing {

  std::string displayName;

  reportFactory factory;

  reportListing(std::string name, reportFactory f) : displayName(name), factory(f) { }

};

 

std::vector<reportListing> reportFactories;

reportFactories.push_back(reportListing("Scenario Analyzer", boost::factory<Apollo::ScenarioAnalyzer*>())); // Apollo::ReportGenerator being the base class from which Apollo::ScenarioAnalyzer is derived

...

 

The constructor for ScenarioAnalyzer is:

ScenarioAnalyzer(Apollo::ApolloBaseModel* model)

 

This fails to compile with the following error (on Windows 7 using Visual C++ 12):

 

error C2664: 'Apollo::ScenarioAnalyzer *boost::factory<Pointer,void,factory_alloc_for_pointee_and_deleter>::operator ()(void) const' : cannot convert argument 1 from 'Apollo::ApolloBaseModel *' to 'Apollo::ApolloBaseModel *&'

 

 

I’m just wondering if that is caused by an intentional change or not, because according to the change log to boost::factory no significant changes with implications to backward compatibility have been made.

Also, I’m not sure I know how to get rid of this error.

 

Thanks for the help!

 

/Fadi

 


Fadi Bitar
Modeling and simulation specialist
Energy Markets

Telephone direct  +46 (0)8 695 64 05
Mobile  +46 725 40 64 05
fadi.bitar@sweco.se

Sweco Energuide AB
Gjörwellsgatan 22
P.O. Box 34044
SE-100 26 Stockholm
Telephone  +46 8 695 60 00

www.sweco.se


 

cid:image001.jpg@01CECF3E.855DC4C0

 

Please consider the environment before printing this e-mail.