diff --git a/types.hpp b/types.hpp index b0948c44..9221422f 100644 --- a/types.hpp +++ b/types.hpp @@ -67,18 +67,22 @@ namespace util { /////////////////////////////////////////////////////////////////////////////// +/// returns the first argument from a parameter pack which can evaluate to true. template T -first (T a) { +first (T a) +{ if (a) return a; throw std::logic_error ("no valid object"); } +//----------------------------------------------------------------------------- template T -first (T a, Args&& ...b) { +first (T a, Args&& ...b) +{ if (a) return a;