Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #10225
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!news.osn.de!diablo2.news.osn.de!news.belwue.de!rz.uni-karlsruhe.de!feed.news.schlund.de!schlund.de!news.online.de!not-for-mail |
|---|---|
| From | Philipp Kraus <philipp.kraus@flashpixx.de> |
| Newsgroups | comp.lang.c++ |
| Subject | index operator overload |
| Date | Sat, 17 Sep 2011 17:23:25 +0200 |
| Organization | 1&1 Internet AG |
| Lines | 22 |
| Message-ID | <j52e1d$bmt$1@online.de> (permalink) |
| NNTP-Posting-Host | p3ee286dc.dip0.t-ipconnect.de |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=iso-8859-1; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Trace | online.de 1316273005 11997 62.226.134.220 (17 Sep 2011 15:23:25 GMT) |
| X-Complaints-To | abuse@einsundeins.com |
| NNTP-Posting-Date | Sat, 17 Sep 2011 15:23:25 +0000 (UTC) |
| User-Agent | Unison/2.1.5 |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.c++:10225 |
Show key headers only | View raw
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