P
Philipp Kraus
Hello,
I would like to overload in my class the [] or () operator. Many
tutorials create the call like
myvaluetype& operator[] (const int&)
or
myvaluetype operator[] (const int&)
but is this correct? An index is in my opinion >= 0, so I should use a
uint like std::size_t .
The call can be also const, because it returns a value with no modify
of object data.
Is there a coding style guide or anything else for a correct call? I
would like to create
my overloading call to:
myvaluetype operator[] (const std::size_t&) const;
Thanks
Phil
I would like to overload in my class the [] or () operator. Many
tutorials create the call like
myvaluetype& operator[] (const int&)
or
myvaluetype operator[] (const int&)
but is this correct? An index is in my opinion >= 0, so I should use a
uint like std::size_t .
The call can be also const, because it returns a value with no modify
of object data.
Is there a coding style guide or anything else for a correct call? I
would like to create
my overloading call to:
myvaluetype operator[] (const std::size_t&) const;
Thanks
Phil