Commit fdf82e06 authored by Dominik Charousset's avatar Dominik Charousset

Remove dead code

parent 01cef548
......@@ -427,88 +427,6 @@ T get_or(const config_value::dictionary& xs, std::string path,
return get_or(xs, {path}, default_value);
}
/*
template <class T>
struct config_value_access<std::vector<T>> {
using vector_type = std::vector<T>;
static bool is(const config_value& x) {
auto lst = caf::get_if<config_value::list>(&x);
if (lst != nullptr) {
return std::all_of(lst->begin(), lst->end(), [](const config_value& x) {
return caf::holds_alternative<T>(x);
});
}
return false;
}
static optional<vector_type> get_if(const config_value* x) {
vector_type result;
auto extract = [&](const config_value& y) {
auto opt = caf::get_if<T>(&y);
if (opt) {
result.emplace_back(*opt);
return true;
}
return false;
};
auto lst = caf::get_if<config_value::list>(x);
if (lst != nullptr && std::all_of(lst->begin(), lst->end(), extract))
return result;
return none;
}
static vector_type get(const config_value& x) {
auto result = get_if(x);
if (!result)
CAF_RAISE_ERROR("invalid type found");
return std::move(*result);
}
};
template <class V>
struct config_value_access<std::map<std::string, V>> {
using map_type = std::map<std::string, V>;
using kvp = std::pair<const std::string, config_value>;
static bool is(const config_value& x) {
auto lst = caf::get_if<config_value::dictionary>(&x);
if (lst != nullptr) {
return std::all_of(lst->begin(), lst->end(), [](const kvp& x) {
return config_value_access<V>::is(x.second);
});
}
return false;
}
static optional<map_type> get_if(const config_value* x) {
map_type result;
auto extract = [&](const kvp& y) {
auto opt = caf::get_if<V>(y.second);
if (opt) {
result.emplace_back(y.first, *opt);
return true;
}
return false;
};
auto lst = caf::get_if<config_value::dictionary>(x);
if (lst != nullptr && std::all_of(lst->begin(), lst->end(), extract))
return result;
return none;
}
static map_type get(const config_value& x) {
auto result = get_if(x);
if (!result)
CAF_RAISE_ERROR("invalid type found");
return std::move(*result);
}
};
*/
/// @relates config_value
bool operator<(const config_value& x, const config_value& y);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment