Skip to content
Snippets Groups Projects
Commit aa7830d0 authored by Frank Gaede's avatar Frank Gaede Committed by Frank Gaede
Browse files

fix optional use of boost::any

parent 9b0e92cb
No related branches found
No related tags found
No related merge requests found
......@@ -23,13 +23,15 @@
#include <typeinfo>
#if __cplusplus >= 201703
# include <any>
#include <any>
inline bool any_has_value(std::any a){ return a.has_value(); }
#else
# include <boost/any.hpp>
namespace std {
using boost::any;
using boost::any_cast;
using boost::bad_any_cast;
inline bool any_has_value(std::any a){ return !a.empty(); }
} // namespace std
#endif
......
......@@ -157,7 +157,7 @@ void PluginService::print_bad_cast(const std::string& id,
str << "Factory requested: " << id << " (" << typeid(signature).name() << ") :" << msg;
printout(ERROR,"PluginService","%s", str.str().c_str());
str.str("");
if ( !stub.has_value() ) {
if ( !any_has_value(stub) ) {
str << "Stub is invalid!";
printout(ERROR,"PluginService","%s", str.str().c_str());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment