Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #37142 > unrolled thread
| Started by | Doug Mika <dougmmika@gmail.com> |
|---|---|
| First post | 2015-07-17 09:52 -0700 |
| Last post | 2015-07-21 08:19 -0700 |
| Articles | 9 — 8 participants |
Back to article view | Back to comp.lang.c++
:: scope resolution operator Doug Mika <dougmmika@gmail.com> - 2015-07-17 09:52 -0700
Re: :: scope resolution operator red floyd <no.spam@its.invalid> - 2015-07-17 10:08 -0700
Re: :: scope resolution operator Doug Mika <dougmmika@gmail.com> - 2015-07-17 11:10 -0700
Re: :: scope resolution operator Paavo Helde <myfirstname@osa.pri.ee> - 2015-07-17 14:16 -0500
Re: :: scope resolution operator Öö Tiib <ootiib@hot.ee> - 2015-07-17 12:27 -0700
Re: :: scope resolution operator Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-07-17 18:51 +0000
Re: :: scope resolution operator Louis Krupp <lkrupp@nospam.pssw.com.invalid> - 2015-07-19 04:49 -0600
Re: :: scope resolution operator legalize+jeeves@mail.xmission.com (Richard) - 2015-07-20 18:59 +0000
Re: :: scope resolution operator red floyd <no.spam.here@its.invalid> - 2015-07-21 08:19 -0700
| From | Doug Mika <dougmmika@gmail.com> |
|---|---|
| Date | 2015-07-17 09:52 -0700 |
| Subject | :: scope resolution operator |
| Message-ID | <14c114ae-8a88-4f58-88b1-3811852ef9b6@googlegroups.com> |
Hi to all I have been reading about C++ for a while, but I must admit, that one of the things that I find confusing is all the instances when you use the scope resolution operator ::. Namespaces, inheritence, etc... So it begs the question, when we write vector<int>::const_iterator myIterator can I deduce from this that const_iterator is an inner class of vector<int> class? Is it? Does anyone know of a easy to read and comprehensive introduction to how/when/why to use the scope resolution operator?
[toc] | [next] | [standalone]
| From | red floyd <no.spam@its.invalid> |
|---|---|
| Date | 2015-07-17 10:08 -0700 |
| Message-ID | <mobco2$3en$1@dont-email.me> |
| In reply to | #37142 |
On 7/17/2015 9:52 AM, Doug Mika wrote:
> Hi to all
>
> I have been reading about C++ for a while, but I must admit, that one of the things that I find confusing is all the instances when you use the scope resolution operator ::. Namespaces, inheritence, etc...
>
> So it begs the question, when we write vector<int>::const_iterator myIterator
> can I deduce from this that const_iterator is an inner class of vector<int> class? Is it?
>
No. It is a *typename* that is defined within vector<int>. It is not
necessarily an inner class.
Example:
class A {
public:
typedef int integral_type;
};
A::integral_type x = 0;
x is of type int.
[toc] | [prev] | [next] | [standalone]
| From | Doug Mika <dougmmika@gmail.com> |
|---|---|
| Date | 2015-07-17 11:10 -0700 |
| Message-ID | <2f529752-4a8f-448f-a0e1-309b5ea7b88a@googlegroups.com> |
| In reply to | #37142 |
On Friday, July 17, 2015 at 11:52:39 AM UTC-5, Doug Mika wrote: > Hi to all > > I have been reading about C++ for a while, but I must admit, that one of the things that I find confusing is all the instances when you use the scope resolution operator ::. Namespaces, inheritence, etc... > > So it begs the question, when we write vector<int>::const_iterator myIterator > can I deduce from this that const_iterator is an inner class of vector<int> class? Is it? > > Does anyone know of a easy to read and comprehensive introduction to how/when/why to use the scope resolution operator? So what precisely is the line inside vector<T> typedef ? const_iterator;
[toc] | [prev] | [next] | [standalone]
| From | Paavo Helde <myfirstname@osa.pri.ee> |
|---|---|
| Date | 2015-07-17 14:16 -0500 |
| Message-ID | <XnsA4DAE284D1BCmyfirstnameosapriee@216.166.105.131> |
| In reply to | #37148 |
Doug Mika <dougmmika@gmail.com> wrote in news:2f529752-4a8f-448f-a0e1-309b5ea7b88a@googlegroups.com: > So what precisely is the line inside vector<T> > > typedef ? const_iterator; http://www.learncpp.com/cpp-tutorial/46-typedefs/
[toc] | [prev] | [next] | [standalone]
| From | Öö Tiib <ootiib@hot.ee> |
|---|---|
| Date | 2015-07-17 12:27 -0700 |
| Message-ID | <4594ab74-7a5b-4955-b751-79031d245ff6@googlegroups.com> |
| In reply to | #37148 |
On Friday, 17 July 2015 21:10:20 UTC+3, Doug Mika wrote: > On Friday, July 17, 2015 at 11:52:39 AM UTC-5, Doug Mika wrote: > > Hi to all > > > > I have been reading about C++ for a while, but I must admit, that one of the things that I find confusing is all the instances when you use the scope resolution operator ::. Namespaces, inheritence, etc... > > > > So it begs the question, when we write vector<int>::const_iterator myIterator > > can I deduce from this that const_iterator is an inner class of vector<int> class? Is it? > > > > Does anyone know of a easy to read and comprehensive introduction to how/when/why to use the scope resolution operator? > > So what precisely is the line inside vector<T> > > typedef ? const_iterator; It is required to be a type that fulfills requirements to random access iterator to const T. http://www.cplusplus.com/reference/iterator/RandomAccessIterator/ What it really is may depend on compiler options. Compiler's documentation may specify more about it but usage of such implementation-specific knowledge results with non-portable code.
[toc] | [prev] | [next] | [standalone]
| From | Jorgen Grahn <grahn+nntp@snipabacken.se> |
|---|---|
| Date | 2015-07-17 18:51 +0000 |
| Message-ID | <slrnmqijkk.2ot.grahn+nntp@frailea.sa.invalid> |
| In reply to | #37142 |
On Fri, 2015-07-17, Doug Mika wrote: > Hi to all > > I have been reading about C++ for a while, but I must admit, that > one of the things that I find confusing is all the instances when you > use the scope resolution operator ::. Namespaces, inheritence, etc... > So it begs the question, when we write vector<int>::const_iterator > myIterator can I deduce from this that const_iterator is an inner > class of vector<int> class? Is it? > Does anyone know of a easy to read and comprehensive introduction to > how/when/why to use the scope resolution operator? *Shrug* Call me lazy, but I use :: when I have to; when the compiler refuses to understand me if I don't. For vector<int>::const_iterator it's obvious that I have to; there is no all-purpose "const_iterator", and I'm not inside the implementation of vector<int>, so I have to be specific (or use "auto"). /Jorgen -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o .
[toc] | [prev] | [next] | [standalone]
| From | Louis Krupp <lkrupp@nospam.pssw.com.invalid> |
|---|---|
| Date | 2015-07-19 04:49 -0600 |
| Message-ID | <6tvmqald55cj4d19qpvq7j2pi4kag4r7a2@4ax.com> |
| In reply to | #37142 |
On Fri, 17 Jul 2015 09:52:11 -0700 (PDT), Doug Mika <dougmmika@gmail.com> wrote: .. snip .. >So it begs the question, when we write vector<int>::const_iterator myIterator >can I deduce from this that const_iterator is an inner class of vector<int> class? Is it? To be pedantic, it doesn't *beg* the question, it *raises* the question. Hopefully, this link is accessible without a New York Times subscription: http://afterdeadline.blogs.nytimes.com/2008/09/25/begging-the-question-again/ That links to this page, which might be helpful: http://begthequestion.info/ And what's C++ all about, if it's not about being pedantic? :) Louis
[toc] | [prev] | [next] | [standalone]
| From | legalize+jeeves@mail.xmission.com (Richard) |
|---|---|
| Date | 2015-07-20 18:59 +0000 |
| Message-ID | <mojge8$abc$1@news.xmission.com> |
| In reply to | #37162 |
[Please do not mail me a copy of your followup]
Louis Krupp <lkrupp@nospam.pssw.com.invalid> spake the secret code
<6tvmqald55cj4d19qpvq7j2pi4kag4r7a2@4ax.com> thusly:
>And what's C++ all about, if it's not about being pedantic? :)
s/C++/comp.lang.c++/ and I'm in agreement.
A tautology is a thing that is tautological.
--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
The Terminals Wiki <http://terminals.classiccmp.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
[toc] | [prev] | [next] | [standalone]
| From | red floyd <no.spam.here@its.invalid> |
|---|---|
| Date | 2015-07-21 08:19 -0700 |
| Message-ID | <molnrr$51d$1@dont-email.me> |
| In reply to | #37173 |
On 7/20/2015 11:59 AM, Richard wrote: > > A tautology is a thing that is tautological. > https://xkcd.com/703/
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.c++
csiph-web