11 #pragma warning(push, 0)
12 #include <boost/variant.hpp>
15 #include <boost/variant.hpp>
29 template <
class T>
struct is_variant : std::false_type {};
33 template <BOOST_VARIANT_ENUM_PARAMS(
typename U)>
struct is_variant<boost::variant<BOOST_VARIANT_ENUM_PARAMS(U)>> : std::true_type {};
37 template <BOOST_VARIANT_ENUM_PARAMS(
typename U)>
struct is_variant<const boost::variant<BOOST_VARIANT_ENUM_PARAMS(U)>> : std::true_type {};
54 template<
typename Key,
typename Value>
71 char* res = abi::__cxa_demangle(t, 0, 0, &status);
72 std::string
type(res);
89 template<
typename T,
typename Output>
91 auto it = this->
find(key);
92 if (it == this->end()) {
93 out() <<
"No value was set for " << key <<
".";
94 assert(it != this->end());
95 }
else if (boost::get<T>(&(it->second)) ==
nullptr) {
96 out() <<
"The type of " << key <<
" should be '" <<
demangle(
typeid(T).name()) <<
"' but is '" <<
demangle(it->second.type().name()) <<
"'.";
97 assert(boost::get<T>(&(it->second)) !=
nullptr);
108 bool has(
const Key& key)
const {
109 auto it = this->
find(key);
110 if (it == this->end())
return false;
111 return boost::get<T>(&(it->second)) !=
nullptr;
120 const T&
get(
const Key& key)
const {
121 auto it = this->
find(key);
122 return boost::get<T>(it->second);
This class is a specialization of std::map where the keys are of arbitrary type and the values are of...
const T & get(const Key &key) const
Returns the value associated with the given key as type T.
bool has(const Key &key) const
Checks if there is a value of the specified type for the given key.
void assertType(const Key &key, Output out) const
Asserts that the value that is associated with the given key has a specified type.
std::string demangle(const char *t) const
Asserts that the value type is a variant.
static bool find(V &ts, const T &t)
QuantifierType type(const std::pair< QuantifierType, std::vector< carl::Variable >> &p)
Class to create the formulas for axioms.
States whether a given type is a boost::variant.