История изменений
Исправление pon4ik, (текущая версия) :
Вот разница между для is_same и is_same_v:
if (is_same_v(a, b)::value) throw "Much cute, but impossible in 11x and forgoten in 14x";
if (is_same<decltype(a),decltype(b)>()::value) throw "Less cute but will work";
А вот разница между твоими вариантами:
if (string::npos == find("abc", 0)) throw "Well known, robust";
if (!find("abc", 0).has_value()) throw "Little bit shorter, need to remember, need to port code to be 21x compatible in 21th";
Исправление pon4ik, :
Вот разница между для is_same и is_same_v:
if (is_same_v(a, b)::value) throw "More cute, but impossible in 11x and forgoten in 14x";
if (is_same<decltype(a),decltype(b)>()::value) throw "Less cute but will work";
А вот разница между твоими вариантами:
if (string::npos == find("abc", 0)) throw "Well known, robust";
if (!find("abc", 0).has_value()) throw "Little bit shorter, need to remember, need to port code to be 21x compatible in 21th";
Исходная версия pon4ik, :
Вот разница между для is_same и is_same_v:
if (is_same_v(a, b)::value) throw "More cute, but impossible in 11x and forgoten in 14x";
if (is_same<decltype(a),decltype(b)>()::value) throw "Less cute but will work";
А вот разница между твоими вариантами:
if (string::npos == find("abc", 0)) throw "Well known, robust";
if (find("abc", 0).has_value()) throw "Little bit shorter, need to remember, need to port code to be 21x compatible in 21th";