473,388 Members | 1,215 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Lack of pointer Typedef in STL container

Looking at vector's header I can see that they provided me with a:
typedef A::reference reference;

But there's no typedef for a pointer to A...

Don't get me wrong I can easily write vector<someting>::value_type*
but it makes me wonder why supplying a typedef for reference
and not for pointer? Any special reasons you know of?
Apr 10 '08 #1
3 1422
ManicQin wrote:
Looking at vector's header I can see that they provided me with a:
typedef A::reference reference;

But there's no typedef for a pointer to A...

Don't get me wrong I can easily write vector<someting>::value_type*
but it makes me wonder why supplying a typedef for reference
and not for pointer? Any special reasons you know of?
The type 'reference' is returned by 'back' or 'front'. Probably due
to the presence of 'vector<bool>' specialisation, which does *not*
have 'reference' as the synonym to 'bool&' prompted the creation of
the 'reference' type. 'pointer' is simply not needed anywhere.

Correct me, somebody.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Apr 10 '08 #2
On Apr 10, 10:20*pm, ManicQin <Manic...@gmail.comwrote:
Looking at vector's header I can see that they provided me with a:
typedef A::reference reference;

But there's no typedef for a pointer to A...

Don't get me wrong I can easily write vector<someting>::value_type*
but it makes me wonder why supplying a typedef for reference
and not for pointer? Any special reasons you know of?
C++03 has "pointer" typedef.

What's implementation you checked out?

Here I check out sgi, it has "pointer"
VC2005, it has
Apr 10 '08 #3
On Apr 10, 5:48*pm, Barry <dhb2...@gmail.comwrote:
On Apr 10, 10:20*pm, ManicQin <Manic...@gmail.comwrote:
Looking at vector's header I can see that they provided me with a:
typedef A::reference reference;
But there's no typedef for a pointer to A...
Don't get me wrong I can easily write vector<someting>::value_type*
but it makes me wonder why supplying a typedef for reference
and not for pointer? Any special reasons you know of?

C++03 has "pointer" typedef.

What's implementation you checked out?

Here I check out sgi, it has "pointer"
VC2005, it has
You're right, The first time I checked in VS6 but after your post I
checked my VS Express and found it.
Thanks.
Apr 10 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Vivi Orunitia | last post by:
Hi all, I tried looking this up in the sgi docs but it didn't provide any concrete answer to what I'm looking for. Basically, is there any difference between using ::iterator for a container vs...
3
by: jjleto | last post by:
I have just learn about "pointer to member". Does someone have an actual example where "pointers to member" are usefull or necessary ? Can't always &(myClass.member) be used ? Thank you.
10
by: techie | last post by:
I'm creating a class BookType that will store information about books. Each book type can have up to 4 authors. I defined a new type for an array of char: typedef char array4_t; This will...
6
by: Nico Kruithof | last post by:
Hello, I have the following problem. Assume I have a templated class (B) that is parameterized by a pointer to another class (A), how can I obtain information of the types of A within B? This...
19
by: Michael | last post by:
Hi, typedef std::vector<Vehicle* VehicleList; Vehicle is a UDT, or a class. Why is Vehicle* not just Vehicle in < >. Which one is better and why? If you could explain it by laying out some...
14
by: Glen Dayton | last post by:
While looking at some old code I ran across a snippet that increments a pointer to access different members of a structure: .... struct Badness { std::string m_begin; std::string m_param1;...
9
by: Sarath | last post by:
Why the following happening? UINT m_uArrXpos; UINT **p = m_uArrXposSchema; // Failed to compile UINT **p = (UINT**)m_uArrXposSchema; // Success compilation
4
by: drhowarddrfine | last post by:
What am I forgetting here. It's the last thing I have to fix after a day of coding. char *box={ "red","blue","green" }; struct item{ char **container; }; struct item *item;
13
by: Phil Bouchard | last post by:
I am currently writting a smart pointer which is reasonnably stable and I decided supporting allocators for completion because of its increase in efficiency when the same pool used by containers is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.