Date: Mon, 13 May 2024 10:03:01 +0200
In the reference implementation, your conversion function isn't
explicit, so you're actually proposing an implicit conversion from
std::any to any type. Is that intentional?
Fwiw, I find it a bit annoying that we need std::any_cast,
std::static_pointer_cast etc., but I'm sure there are good design
reasons for why we have these function templates. Perhaps one of the
reasons is that the syntax "T(my_any)" uses explicit conversions,
unlike "T t(my_any)".
Anyhow, "Improve readability" and "Simplified usage" are relatively
subjective benefits, and any proposal needs to make C++ strictly
better. You would also need to look at the costs/downsides of not
using std::any_cast and demonstrate that the status quo is bad and
your proposal is not just better, but so much better that it's worth
committee time.
explicit, so you're actually proposing an implicit conversion from
std::any to any type. Is that intentional?
Fwiw, I find it a bit annoying that we need std::any_cast,
std::static_pointer_cast etc., but I'm sure there are good design
reasons for why we have these function templates. Perhaps one of the
reasons is that the syntax "T(my_any)" uses explicit conversions,
unlike "T t(my_any)".
Anyhow, "Improve readability" and "Simplified usage" are relatively
subjective benefits, and any proposal needs to make C++ strictly
better. You would also need to look at the costs/downsides of not
using std::any_cast and demonstrate that the status quo is bad and
your proposal is not just better, but so much better that it's worth
committee time.
Received on 2024-05-13 08:03:14