Iterator help needed


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Iterator help needed
# 1  
Old 02-28-2005
Iterator help needed

I have a question about iterators. Here is the code I have

Code:
template <typename element> 
void merge_sort(vector<element> &v) 
{ 
   element::iterator lo; 
     
}

Now thats all the code I have for the non-recursive merge sort at the moment, which obvioulsy isn't a lot, but I need to get this small problem worked out first. I am trying to create this iterator called lo, which will be equal to v.begin(). The problem is when I compile that code above, I get the following error:

merge_sort.cc: In function `void merge_sort(std::vector<element,
std::allocator<_CharT> >&)':
merge_sort.cc:13: error: parse error before `;' token

Where is this parse error? What am I not doing correctly to create the iterator?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help needed

First of all, let me state that I am a windows admin. I have a windows share mounted to /mnt/server I need a script that will either login as sudo or perform commands with sudo rights. I need the script to copy all of the users /home folders to the mounted windows share. Now If I can... (2 Replies)
Discussion started by: EricM
2 Replies

2. HP-UX

Error in include_std/limit and include_std/rw/iterator

I get following compile time errors on HP ITANIUM machine "/opt/include_std/limit", line 268: error # 2321: data member initializer is not allowed _RWSTD_STATIC_CONST (bool, is_specialized = false); "/opt/include_std/rw/iterator", line 119: error # 2247: class template "std::iterator_traits"... (0 Replies)
Discussion started by: dodo_ind
0 Replies

3. Programming

Random Access Iterator Error

I am unable to resolve the below code compilation issue: class A { public: int x; }; void sort_A(TArray<A> &_Atype) { std::stable_sort (_Atype.begin(), _Atype.end()); } bool operator< (const A & _a1, const A & _a2) { return _a1.x < _a2.x; } When we compile using gcc 4.1.2... (4 Replies)
Discussion started by: uunniixx
4 Replies

4. Shell Programming and Scripting

Help on these two needed ...!!

Folks I need help on following two. 1. Say i am getting two values like this ::1:953 and :::8005 I need to replace "::" (first two colons with a * ).I can get these values in a variable.How to tweak this variable to separate out the way i want? Anything after third ":" should be set... (9 Replies)
Discussion started by: ak835
9 Replies

5. Programming

STL Iterator and user-defined class

Is is possible to make STL-Iterator to work with user defined class ,like the one below? #include <iostream> #include <stdexcept> using namespace std; template <class T> class Array { public: T& operator (unsigned i) throw(out_of_range) { return data_; } protected: ... (2 Replies)
Discussion started by: johnbach
2 Replies

6. IP Networking

Help needed

Hi, Can anyone please tell me where I can get the small projects with source code based on client-server programming using sockets in unix :confused::confused::confused: Thanks in advance... (1 Reply)
Discussion started by: smartgupta
1 Replies

7. UNIX for Dummies Questions & Answers

little help needed..

hi everyone i'm a noob trying to learn unix language.. but seems like i got no leads on how to start.. i'm playing with the 'ps' command.. i'm trying to show the pid, ppid, username, command, cpu utilization (in desc order), process start time and process status.. all in a command.. am i able... (3 Replies)
Discussion started by: hilofat
3 Replies

8. Shell Programming and Scripting

Help needed

Hi, I am beginner writing shell script i am using korn shell. I wrote shell script through which i am passing system date as parameter to build.xml file but i need to write a function when i pass systemdate as parameter the function has to return its respective quarterly date . Can any one... (0 Replies)
Discussion started by: connectpramod
0 Replies

9. AIX

Little help needed.

Hello, I am quite new to AIX, but have Linux experience. Iam facing a peoblem with AIX 5.2 running on a 43p Model 150 (RS6000). I tried everyting and i cant have the network to run properly. :confused: /etc/hosts looks like this: 127.0.0.1 loopback localhost 192.168.XXX.XXX... (5 Replies)
Discussion started by: Netghost
5 Replies

10. Shell Programming and Scripting

Help is needed

Hi I'm trying to print a directories struct tree that will look like this: A _a _b _B __c __d __C ___e B _a _b I'm doing a recursion, but how can I know how much space is needed before printing after the recursion? (3 Replies)
Discussion started by: abcde
3 Replies
Login or Register to Ask a Question
__gnu_pbds::detail::bin_search_tree_const_node_i__gnu_pbds::detail::bin_search_tree_const_node_it_< Node, Const_Iterator, Iterator, _Alloc >(3cxx)

NAME
__gnu_pbds::detail::bin_search_tree_const_node_it_< Node, Const_Iterator, Iterator, _Alloc > - SYNOPSIS
Inherited by __gnu_pbds::detail::bin_search_tree_node_it_< Node, Const_Iterator, Iterator, _Alloc >. Public Types typedef Const_Iterator const_reference typedef trivial_iterator_difference_type difference_type" typedef trivial_iterator_tag iterator_category typedef _Alloc::template rebind< metadata_type > ::other::const_reference metadata_const_reference" typedef Node::metadata_type metadata_type typedef Const_Iterator reference typedef Const_Iterator value_type Public Member Functions bin_search_tree_const_node_it_ (const node_pointer p_nd=0) bin_search_tree_const_node_it_ < Node, Const_Iterator, Iterator, _Alloc > get_l_child () const " metadata_const_reference get_metadata () const bin_search_tree_const_node_it_ < Node, Const_Iterator, Iterator, _Alloc > get_r_child () const " bool operator!= (const bin_search_tree_const_node_it_< Node, Const_Iterator, Iterator, _Alloc > &other) const const_reference operator* () const bool operator== (const bin_search_tree_const_node_it_< Node, Const_Iterator, Iterator, _Alloc > &other) const Public Attributes node_pointer m_p_nd Detailed Description template<typename Node, class Const_Iterator, class Iterator, typename _Alloc>class __gnu_pbds::detail::bin_search_tree_const_node_it_< Node, Const_Iterator, Iterator, _Alloc > Const node iterator. Definition at line 58 of file bin_search_tree_/node_iterators.hpp. Member Typedef Documentation template<typename Node , class Const_Iterator , class Iterator , typename _Alloc > typedef Const_Iterator __gnu_pbds::detail::bin_search_tree_const_node_it_< Node, Const_Iterator, Iterator, _Alloc >::const_reference Iterator's __const reference type. Definition at line 80 of file bin_search_tree_/node_iterators.hpp. template<typename Node , class Const_Iterator , class Iterator , typename _Alloc > typedef trivial_iterator_difference_type __gnu_pbds::detail::bin_search_tree_const_node_it_< Node, Const_Iterator, Iterator, _Alloc >::difference_type Difference type. Definition at line 71 of file bin_search_tree_/node_iterators.hpp. template<typename Node , class Const_Iterator , class Iterator , typename _Alloc > typedef trivial_iterator_tag __gnu_pbds::detail::bin_search_tree_const_node_it_< Node, Const_Iterator, Iterator, _Alloc >::iterator_category Category. Definition at line 68 of file bin_search_tree_/node_iterators.hpp. template<typename Node , class Const_Iterator , class Iterator , typename _Alloc > typedef _Alloc::template rebind<metadata_type>::other::const_reference __gnu_pbds::detail::bin_search_tree_const_node_it_< Node, Const_Iterator, Iterator, _Alloc >::metadata_const_reference Const metadata reference type. Definition at line 88 of file bin_search_tree_/node_iterators.hpp. template<typename Node , class Const_Iterator , class Iterator , typename _Alloc > typedef Node::metadata_type __gnu_pbds::detail::bin_search_tree_const_node_it_< Node, Const_Iterator, Iterator, _Alloc >::metadata_type Metadata type. Definition at line 83 of file bin_search_tree_/node_iterators.hpp. template<typename Node , class Const_Iterator , class Iterator , typename _Alloc > typedef Const_Iterator __gnu_pbds::detail::bin_search_tree_const_node_it_< Node, Const_Iterator, Iterator, _Alloc >::reference Iterator's reference type. Definition at line 77 of file bin_search_tree_/node_iterators.hpp. template<typename Node , class Const_Iterator , class Iterator , typename _Alloc > typedef Const_Iterator __gnu_pbds::detail::bin_search_tree_const_node_it_< Node, Const_Iterator, Iterator, _Alloc >::value_type Iterator's value type. Definition at line 74 of file bin_search_tree_/node_iterators.hpp. Member Function Documentation template<typename Node , class Const_Iterator , class Iterator , typename _Alloc > bin_search_tree_const_node_it_<Node, Const_Iterator, Iterator, _Alloc> __gnu_pbds::detail::bin_search_tree_const_node_it_< Node, Const_Iterator, Iterator, _Alloc >::get_l_child () const [inline] Returns the __const node iterator associated with the left node. Definition at line 107 of file bin_search_tree_/node_iterators.hpp. template<typename Node , class Const_Iterator , class Iterator , typename _Alloc > metadata_const_reference __gnu_pbds::detail::bin_search_tree_const_node_it_< Node, Const_Iterator, Iterator, _Alloc >::get_metadata () const [inline] Metadata access. Definition at line 102 of file bin_search_tree_/node_iterators.hpp. template<typename Node , class Const_Iterator , class Iterator , typename _Alloc > bin_search_tree_const_node_it_<Node, Const_Iterator, Iterator, _Alloc> __gnu_pbds::detail::bin_search_tree_const_node_it_< Node, Const_Iterator, Iterator, _Alloc >::get_r_child () const [inline] Returns the __const node iterator associated with the right node. Definition at line 112 of file bin_search_tree_/node_iterators.hpp. template<typename Node , class Const_Iterator , class Iterator , typename _Alloc > bool __gnu_pbds::detail::bin_search_tree_const_node_it_< Node, Const_Iterator, Iterator, _Alloc >::operator!= (const bin_search_tree_const_node_it_< Node, Const_Iterator, Iterator, _Alloc > &other) const [inline] Compares (negatively) to a different iterator object. Definition at line 122 of file bin_search_tree_/node_iterators.hpp. template<typename Node , class Const_Iterator , class Iterator , typename _Alloc > const_reference __gnu_pbds::detail::bin_search_tree_const_node_it_< Node, Const_Iterator, Iterator, _Alloc >::operator* () const [inline] Access. Definition at line 97 of file bin_search_tree_/node_iterators.hpp. template<typename Node , class Const_Iterator , class Iterator , typename _Alloc > bool __gnu_pbds::detail::bin_search_tree_const_node_it_< Node, Const_Iterator, Iterator, _Alloc >::operator== (const bin_search_tree_const_node_it_< Node, Const_Iterator, Iterator, _Alloc > &other) const [inline] Compares to a different iterator object. Definition at line 117 of file bin_search_tree_/node_iterators.hpp. Author Generated automatically by Doxygen for libstdc++ from the source code. libstdc++ __gnu_pbds::detail::bin_search_tree_const_node_it_< Node, Const_Iterator, Iterator, _Alloc >(3cxx)