Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #10225
| From | Philipp Kraus <philipp.kraus@flashpixx.de> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | index operator overload |
| Date | 2011-09-17 17:23 +0200 |
| Organization | 1&1 Internet AG |
| Message-ID | <j52e1d$bmt$1@online.de> (permalink) |
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
Back to comp.lang.c++ | Previous | Next — Next in thread | Find similar | Unroll thread
index operator overload Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-09-17 17:23 +0200
Re: index operator overload Marc <marc.glisse@gmail.com> - 2011-09-17 16:18 +0000
Re: index operator overload Noah Roberts <roberts.noah@gmail.com> - 2011-09-17 09:53 -0700
Re: index operator overload Marc <marc.glisse@gmail.com> - 2011-09-17 18:22 +0000
Re: index operator overload Nobody <nobody@nowhere.com> - 2011-09-17 19:32 +0100
Re: index operator overload James Kanze <james.kanze@gmail.com> - 2011-09-19 15:31 -0700
Re: index operator overload Leigh Johnston <leigh@i42.co.uk> - 2011-09-19 23:41 +0100
Re: index operator overload Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-09-20 21:50 +0200
csiph-web