samedi 30 septembre 2017

Pre-C++14 template metaprogramming and ternary operator

From cppreference.com:

Such conditional operator was commonly used in C++11 constexpr programming prior to C++14.

std::string str = 2+2==4 ? "ok" : throw std::logic_error("2+2 != 4");

What does cppreference refer to? What was the pre-C++14 idiom and why in C++14 that technique is no longer relevant?

Aucun commentaire:

Enregistrer un commentaire