|
|
@ -119,13 +119,14 @@ namespace std
|
|
|
|
* visitor to produce json representations of
|
|
|
|
* visitor to produce json representations of
|
|
|
|
* values stored in mstch::node
|
|
|
|
* values stored in mstch::node
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
class mstch_node_to_json: public boost::static_visitor<nlohmann::json> {
|
|
|
|
class mstch_node_to_json: public boost::static_visitor<nlohmann::json>
|
|
|
|
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// enabled for numeric types
|
|
|
|
// enabled for numeric types
|
|
|
|
template<typename T>
|
|
|
|
template<typename T>
|
|
|
|
std::enable_if_t<std::is_arithmetic<T>::value, nlohmann::json>
|
|
|
|
typename std::enable_if<std::is_arithmetic<T>::value, nlohmann::json>::type
|
|
|
|
operator()(T const& value) const {
|
|
|
|
operator()(T const& value) const {
|
|
|
|
return nlohmann::json {value};
|
|
|
|
return nlohmann::json {value};
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -157,7 +158,7 @@ public:
|
|
|
|
|
|
|
|
|
|
|
|
// catch other types that are non-numeric and not listed above
|
|
|
|
// catch other types that are non-numeric and not listed above
|
|
|
|
template<typename T>
|
|
|
|
template<typename T>
|
|
|
|
std::enable_if_t<!std::is_arithmetic<T>::value, nlohmann::json>
|
|
|
|
typename std::enable_if<!std::is_arithmetic<T>::value, nlohmann::json>::type
|
|
|
|
operator()(const T&) const {
|
|
|
|
operator()(const T&) const {
|
|
|
|
return nlohmann::json {};
|
|
|
|
return nlohmann::json {};
|
|
|
|
}
|
|
|
|
}
|
|
|
|