Marc Schellens <m_*********@hotmail.com> wrote:
the complier says:
io.hpp:43: field initializer is not constant
why?
As a first guess I would pretend that the initializer is not constant...
Maybe I should elaborate a little bit: there is no requirement that the open
mode is one of the built-in integral types. It can be an enumeration (I think
it is required to be an integral type, however; ie. it cannot be, for example,
'std::bitset<6>'). For enumerations the bitwise logic operations are not
automatically defined and it requires overloading them to turn the enumeration
into a bitmask. Overloading involves function calls and the result of a
function call is never a constant expression as is required in your example.
I agree that your expression should be a constant expression ie. that eg.
inline functions depending strictly only on their arguments should capable of
producing constant expression if their arguments are all constant expressions.
However, the current C++ specification has no such provision.
--
<mailto:di***********@yahoo.com> <http://www.dietmar-kuehl.de/>
Phaidros eaSE - Easy Software Engineering: <http://www.phaidros.com/>