types: style

This commit is contained in:
Danny Robson 2016-01-27 15:32:58 +11:00
parent 800d7fef00
commit fa9a2e3864

View File

@ -67,18 +67,22 @@ namespace util {
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// returns the first argument from a parameter pack which can evaluate to true.
template <class T> template <class T>
T T
first (T a) { first (T a)
{
if (a) if (a)
return a; return a;
throw std::logic_error ("no valid object"); throw std::logic_error ("no valid object");
} }
//-----------------------------------------------------------------------------
template <class T, class ...Args> template <class T, class ...Args>
T T
first (T a, Args&& ...b) { first (T a, Args&& ...b)
{
if (a) if (a)
return a; return a;