Under 24.2.3 Input iterators
, the C++ standard specifies one of the requirements of input iterator as the expression (void)r++
being equivalent to (void)++r
.
You can also see this at cppreference.
What is that expression? What is the significance of this requirement? Why is it needed?
It looks like a C style cast to void of the result of r++
or ++r
but I don't think that's what it really is. That said, to digress a bit, it looks like I can define a void
conversion operator inside a class. Both gcc and clang compile it but clang gives the warning:
warning: conversion function converting 'C' to 'void' will never be used