feat(util/sexpr/options): add update_if_undef method

This commit is contained in:
Leonardo de Moura 2015-01-08 11:55:30 -08:00
parent f344dd75c4
commit 4fef19230d

View file

@ -55,6 +55,13 @@ public:
options update(char const * n, sexpr const & v) const { return update(name(n), v); } options update(char const * n, sexpr const & v) const { return update(name(n), v); }
template<typename T> options update(char const * n, T v) const { return update(n, sexpr(v)); } template<typename T> options update(char const * n, T v) const { return update(n, sexpr(v)); }
template<typename T> options update_if_undef(name const & n, T v) const {
if (contains(n))
return *this;
else
return update(n, sexpr(v));
}
friend bool is_eqp(options const & a, options const & b) { return is_eqp(a.m_value, b.m_value); } friend bool is_eqp(options const & a, options const & b) { return is_eqp(a.m_value, b.m_value); }
/** /**