Commit a0447ba9 by Maarten L. Hekkelman

implemented missing function cif::Category::find1

parent 17c9d208
...@@ -1717,7 +1717,18 @@ class Category ...@@ -1717,7 +1717,18 @@ class Category
return find1(cbegin(), std::forward<Condition>(cond)); return find1(cbegin(), std::forward<Condition>(cond));
} }
Row find1(const_iterator pos, Condition&& cond); Row find1(const_iterator pos, Condition&& cond)
{
auto h = find(pos, std::forward<Condition>(cond));
if (h.empty())
throw std::runtime_error("No hits found");
if (h.size() != 1)
throw std::runtime_error("Hit not unique");
return *h.begin();
}
template<typename... Ts, size_t N> template<typename... Ts, size_t N>
std::tuple<Ts...> find1(Condition&& cond, char const* const (&columns)[N]) std::tuple<Ts...> find1(Condition&& cond, char const* const (&columns)[N])
......
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