473,396 Members | 1,655 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,396 software developers and data experts.

value_type of vector

Hello everyone,
I think the value_type of vector<intshould be int and the value_type
of vector<intshould be int*. But I am not 100% sure,

1. how to write a program to verify this idea;
2. where to find the definition that the value_type of interator of
vector<intis int*.

It is appreciated if you could help.

Expand|Select|Wrap|Line Numbers
  1. #include <vector>
  2.  
  3. using namespace std;
  4.  
  5. int main (int argc, char** argv)
  6. {
  7. vector<int>::value_type;  // should be int ?
  8. vector<int>::iterator::value_type; // should be int* ?
  9.  
  10. return 0;
  11. }
  12.  

thanks in advance,
George
Nov 19 '07 #1
3 2138
George2 said:
I think the value_type of vector<intshould be int and the value_type
of vector<intshould be int*. But I am not 100% sure,

1. how to write a program to verify this idea;
2. where to find the definition that the value_type of interator of
vector<intis int*.
Try asking in comp.lang.c++, where they might have a fighting chance of
answering your question correctly.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Nov 19 '07 #2
In article
<2b**********************************@e10g2000prf. googlegroups.com>,
George2 <ge*************@yahoo.comwrote on Monday 19 Nov 2007 8:40
am:
Hello everyone,
I think the value_type of vector<intshould be int and the value_type
of vector<intshould be int*. But I am not 100% sure,

1. how to write a program to verify this idea;
2. where to find the definition that the value_type of interator of
vector<intis int*.

It is appreciated if you could help.

Expand|Select|Wrap|Line Numbers
  1. #include <vector>
  2. using namespace std;
  3. int main (int argc, char** argv)
  4. {
  5. vector<int>::value_type;  // should be int ?
  6. vector<int>::iterator::value_type; // should be int* ?
  7. return 0;
  8. }
  9.  
Isn't this the third time you have posted C++ code or question to a C
group? Please post C++ questions in <news:comp.lang.c++>.

Nov 19 '07 #3
George2 wrote:
Hello everyone,
I think the value_type of vector<intshould be int and the value_type
of vector<intshould be int*. But I am not 100% sure,
'vector<int>' is a syntax error in C. You probably want a newsgroup for
a different language, perhaps one where 'value_type' actually has a meaning.
Nov 19 '07 #4

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

Similar topics

9
by: Chyi Pin Lim | last post by:
Why is the type for back_insert_iterator void and not the type of its encapsulating container? Why: namespace std { template<class Category, class T, class Distance = ptrdiff_t, class...
8
by: chris | last post by:
I tried to post this to comp.std.c++ some time ago, but for some reason I aren't getting any automatic confirmation. I thought I would therefore post it here. Some time ago I submitted what is...
5
by: cesco | last post by:
I'm designing an algorithm with maps that need the elements to be sorted by value instead of by key. Does anyone have a suggestion on how to do that? #include <map> using namespace std; int...
4
by: Andrew | last post by:
Hello: Can someone please elaborate on why the member types 'value_type', 'reference', and 'const_reference' are all defined in a standard STL container. Why not just define 'value_type' and...
6
by: Daniel T. | last post by:
The line marked (1) below compiles fine and does exactly what I would expect, but the line marked (2) does not compile at all on my system. error: variable or field 'bar' declared void My...
4
by: FabioAng | last post by:
Assuming I have this function: template<typename OutputIterator> void copy(const char* input, OutputIterator result) { while ( *input != NULL ) { *result = *input; ++result; ++input;
3
by: massysett | last post by:
I'm puzzled about part of the standard. 23.1 states that items stored in a container must be assignable. Therefore, the items in a map--that is, std::pair<const Key, valuemust be assignable....
1
by: antoanish | last post by:
Hello, My Requirement is 1. Copy data from iterator to an array ( array should be created dynamically within the function based on data_type of the data held by the iterator /container. )...
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:
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.