Discussion:
[std-proposals] if (... ;...)
Phil Bouchard
2018-11-19 04:55:05 UTC
Permalink
Greetings,

The if statement should have some for-like syntax in order to initialize a
variable and evaluate a condition. Ex:

if (ClassA a = getA(); a.isValid())
{
cout << "a is valid" << endl;
}

This is much cleaner!


Regards,
-Phil
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+***@isocpp.org.
To post to this group, send email to std-***@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/85675c90-57f3-4db8-8419-a34cacefa483%40isocpp.org.
Maxim Yanchenko
2018-11-19 04:56:23 UTC
Permalink
Hi Phil,

This was already added in C++17

Maxim
Post by Phil Bouchard
Greetings,
The if statement should have some for-like syntax in order to initialize a
if (ClassA a = getA(); a.isValid())
{
cout << "a is valid" << endl;
}
This is much cleaner!
Regards,
-Phil
--
You received this message because you are subscribed to the Google Groups
"ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/85675c90-57f3-4db8-8419-a34cacefa483%40isocpp.org
<https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/85675c90-57f3-4db8-8419-a34cacefa483%40isocpp.org?utm_medium=email&utm_source=footer>
.
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+***@isocpp.org.
To post to this group, send email to std-***@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CA%2B6mTDcFKxBQkD91z0bRAcsYQGBh24Vd23_JHXJ%2BdeGVQQDPbw%40mail.gmail.com.
Phil Bouchard
2018-11-19 04:57:23 UTC
Permalink
Nice!
Post by Maxim Yanchenko
Hi Phil,
This was already added in C++17
Maxim
Post by Phil Bouchard
Greetings,
The if statement should have some for-like syntax in order to initialize
if (ClassA a = getA(); a.isValid())
{
cout << "a is valid" << endl;
}
This is much cleaner!
Regards,
-Phil
--
You received this message because you are subscribed to the Google Groups
"ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/85675c90-57f3-4db8-8419-a34cacefa483%40isocpp.org
<https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/85675c90-57f3-4db8-8419-a34cacefa483%40isocpp.org?utm_medium=email&utm_source=footer>
.
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+***@isocpp.org.
To post to this group, send email to std-***@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/ce1f90de-f69d-4441-9afb-7394987103c2%40isocpp.org.
Continue reading on narkive:
Loading...