Boost logo

Boost Users :

Subject: [Boost-users] Compile error with boost::factory after upgrade to 1.58.0
From: Bitar Fadi (Fadi.Bitar_at_[hidden])
Date: 2015-04-18 05:05:14


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_at_[hidden]<mailto:fadi.bitar_at_[hidden]>

Sweco Energuide AB
Gjörwellsgatan 22
P.O. Box 34044
SE-100 26 Stockholm
Telephone +46 8 695 60 00
www.sweco.se<http://www.sweco.se/>

[cid:image001.jpg_at_01CECF3E.855DC4C0]

Please consider the environment before printing this e-mail.




image001.jpg

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net