C++ Weekly - Ep 66 - Variadic fmin for C++11

preview_player
Показать описание
☟☟ Awesome T-Shirts! Sponsors! Books! ☟☟

T-SHIRTS AVAILABLE!

WANT MORE JASON?

SUPPORT THE CHANNEL

GET INVOLVED

JASON'S BOOKS

► C++23 Best Practices

► C++ Best Practices

JASON'S PUZZLE BOOKS

► Object Lifetime Puzzlers Book 1

► Object Lifetime Puzzlers Book 2

► Object Lifetime Puzzlers Book 3

► Copy and Reference Puzzlers Book 1

► Copy and Reference Puzzlers Book 2

► Copy and Reference Puzzlers Book 3

► OpCode Puzzlers Book 1


RECOMMENDED BOOKS

AWESOME PROJECTS

O'Reilly VIDEOS

Рекомендации по теме
Комментарии
Автор

I had another idea:template <typename F, typename ...T>
 auto var_fmin2(const F& f, const T& ...t)
  {
    if (sizeof...(T)==0)
       return f;
    else
       return std::min(f, var_fmin2(t...));
  }I can't get this to compile, probably because the "if" is not compile time. Is there a way to get something like this working?

johnlysons
Автор

I'm trying to play with your godbolt compiler explorer tool, but how do I get it to show the output of the code?

Orgyilkos
Автор

Why not check if it conforms to c++11? Unfortunately it does not, by the way.

ilejncs
Автор

When you clumped many C++ features including syntax together, the code really look ugly. Excellent demo though. Hope to see more features in real world application or projects.

areriff