You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
706 B
42 lines
706 B
#pragma once
|
|
|
|
#include <boost/variant/static_visitor.hpp>
|
|
|
|
#include "mstch/mstch.hpp"
|
|
|
|
namespace mstch {
|
|
|
|
class is_node_empty: public boost::static_visitor<bool> {
|
|
public:
|
|
template<class T>
|
|
bool operator()(const T&) const {
|
|
return false;
|
|
}
|
|
|
|
bool operator()(const std::nullptr_t&) const {
|
|
return true;
|
|
}
|
|
|
|
bool operator()(const int& value) const {
|
|
return value == 0;
|
|
}
|
|
|
|
bool operator()(const double& value) const {
|
|
return value == 0;
|
|
}
|
|
|
|
bool operator()(const bool& value) const {
|
|
return !value;
|
|
}
|
|
|
|
bool operator()(const std::string& value) const {
|
|
return value == "";
|
|
}
|
|
|
|
bool operator()(const array& array) const {
|
|
return array.size() == 0;
|
|
}
|
|
};
|
|
|
|
}
|