Sponsored Content
Top Forums Programming Finding items that occur more than once in a vector Post 302520867 by LMHmedchem on Monday 9th of May 2011 11:59:04 AM
Old 05-09-2011
Quote:
Originally Posted by Corona688
If you don't want duplicates, why not use a set?
I actually need to know what the duplicates are.

These are graph verticies that get accumulated for various reasons. Those that occur on the same list more than once have different significance and get processed differently. I need to split up these vectors into a list of verticies that occur only once, and a second list of verticies that occur more than once. Theses are very small data structures, so I am trying to keep things simple. I was hoping there was a library function that I could send the vector to and get back a list of dups, but no such luck it would appear. I can do this with a double loop, but that seems un-elegant.

A map<int,int>, or a multiset are two ideas at the moment. I tried briefly with a multiset, but couldn't get it to compile. I will try again in a bit.

LMHmedchem
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Why SIGKILL will occur?

Hi Gurus, I am executing my Datastage jobs on UNIX operating System. While running the jobs i am getting the following error: main_program: Unexpected termination by Unix signal 9(SIGKILL) Can any one please let me know what are the possible situations where this SIGKILL will arrise? ... (9 Replies)
Discussion started by: choppas
9 Replies

2. Shell Programming and Scripting

how many times a word occur in afile

i want a shell script program for how many times a word occur in a file. i need not the line number but i want the counts of the particular word for eg:- hai how r u.. i am from andhra pradesh.. i am from tenali.i need this answer.i need it urgently.. i hope u will answer this ... ... (9 Replies)
Discussion started by: madhu.it
9 Replies

3. Shell Programming and Scripting

awk between items including items

OS=HP-UX ksh The following works, except I want to include the <start> and <end> in the output. awk -F '<start>' 'BEGIN{RS="<end>"; OFS="\n"; ORS=""} {print $2} somefile.log' The following work in bash but not in ksh sed -n '/^<start>/,/^<end>/{/LABEL$/!p}' somefile.log (4 Replies)
Discussion started by: Ikon
4 Replies

4. Shell Programming and Scripting

finding missing items in file

I have a need to compare 2 files, then print results to file. Need to find items from file2 that are not found in file 1. thanks in advance! example: file 1: abcde=12 fffff=6 bbbb=35 file2: abcde=12 fffff=6 bbbb=35 ccccc=10 kkkkk=45 (8 Replies)
Discussion started by: discostu
8 Replies

5. Shell Programming and Scripting

To find number of char occur

To find out number of "|" symbol is available in file: Input: a|b|c|d|z Ouput: 4 I am using below set of commands,It is working... Anybody have anyother solution using sed / awk. cnt=`wc -c <1.txt` cnt1=`tr -d "|" <1.txt >c.dat` cnt2=`wc -c <c.dat` outp=`expr $cnt... (19 Replies)
Discussion started by: Jairaj
19 Replies

6. UNIX for Dummies Questions & Answers

C shell loop problem occur

Hi all, i create 2 file Config path1 5 group1 path2 6 group2 path3 10 group1 path4 15 group2 Confine group1 andrew group2 alan In my C shell script i write like this: set line_array = (`cat $app_dir/config`) set line_array_2 =... (0 Replies)
Discussion started by: proghack
0 Replies

7. Shell Programming and Scripting

Print lines where variables occur more than once using grep

Hello, I want to only print lines where variables occur more than once using grep. For eg: Input: $this is a comment int a,b,c,b; int b,c; int d,e; int f,g,f; x=y+5; For the above input, the output would be int a,b,c,b; int f,g,f; I have done grep... (3 Replies)
Discussion started by: prasanna1157
3 Replies

8. Shell Programming and Scripting

Help with Perl script that can check a URL and notifiy when changes occur

I'm a scripting newbie and I'm trying to learn. No better way than being assigned a project. So basically, I'm trying to come up with a script that can periodically check a URL and then notify when changes occur to the file. So what I'm thinking is that I need to devise a PERL script that... (3 Replies)
Discussion started by: adam1mc
3 Replies

9. Cybersecurity

Where does Ciphering & Encryption occur?

Hello everyone. Upon reading the recent news about the NSA paying RSA to use a faulty cipher suite for it's default, it got me thinking... During a connection say for SSL, what is it that "knows" the rules for ciphers? Are these rules stored on the NIC? can they be edited, changed or appended? ... (3 Replies)
Discussion started by: Lost in Cyberia
3 Replies
std::__debug(3cxx)														std::__debug(3cxx)

NAME
std::__debug - SYNOPSIS
Classes class bitset Class std::bitset with additional safety/checking/debug instrumentation. class deque Class std::deque with safety/checking/debug instrumentation. class forward_list Class std::forward_list with safety/checking/debug instrumentation. class list Class std::list with safety/checking/debug instrumentation. class map Class std::map with safety/checking/debug instrumentation. class multimap Class std::multimap with safety/checking/debug instrumentation. class multiset Class std::multiset with safety/checking/debug instrumentation. class set Class std::set with safety/checking/debug instrumentation. class unordered_map Class std::unordered_map with safety/checking/debug instrumentation. class unordered_multimap Class std::unordered_multimap with safety/checking/debug instrumentation. class unordered_multiset Class std::unordered_multiset with safety/checking/debug instrumentation. class unordered_set Class std::unordered_set with safety/checking/debug instrumentation. class vector Class std::vector with safety/checking/debug instrumentation. Functions template<typename _Value , typename _Hash , typename _Pred , typename _Alloc > bool operator!= (const unordered_set< _Value, _Hash, _Pred, _Alloc > &__x, const unordered_set< _Value, _Hash, _Pred, _Alloc > &__y) template<typename _Key , typename _Tp , typename _Hash , typename _Pred , typename _Alloc > bool operator!= (const unordered_map< _Key, _Tp, _Hash, _Pred, _Alloc > &__x, const unordered_map< _Key, _Tp, _Hash, _Pred, _Alloc > &__y) template<typename _Key , typename _Compare , typename _Allocator > bool operator!= (const multiset< _Key, _Compare, _Allocator > &__lhs, const multiset< _Key, _Compare, _Allocator > &__rhs) template<typename _Key , typename _Compare , typename _Allocator > bool operator!= (const set< _Key, _Compare, _Allocator > &__lhs, const set< _Key, _Compare, _Allocator > &__rhs) template<typename _Key , typename _Tp , typename _Compare , typename _Allocator > bool operator!= (const multimap< _Key, _Tp, _Compare, _Allocator > &__lhs, const multimap< _Key, _Tp, _Compare, _Allocator > &__rhs) template<typename _Key , typename _Tp , typename _Compare , typename _Allocator > bool operator!= (const map< _Key, _Tp, _Compare, _Allocator > &__lhs, const map< _Key, _Tp, _Compare, _Allocator > &__rhs) template<typename _Tp , typename _Alloc > bool operator!= (const deque< _Tp, _Alloc > &__lhs, const deque< _Tp, _Alloc > &__rhs) template<typename _Tp , typename _Alloc > bool operator!= (const vector< _Tp, _Alloc > &__lhs, const vector< _Tp, _Alloc > &__rhs) template<typename _Value , typename _Hash , typename _Pred , typename _Alloc > bool operator!= (const unordered_multiset< _Value, _Hash, _Pred, _Alloc > &__x, const unordered_multiset< _Value, _Hash, _Pred, _Alloc > &__y) template<typename _Key , typename _Tp , typename _Hash , typename _Pred , typename _Alloc > bool operator!= (const unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc > &__x, const unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc > &__y) template<typename _Tp , typename _Alloc > bool operator!= (const forward_list< _Tp, _Alloc > &__lx, const forward_list< _Tp, _Alloc > &__ly) template<typename _Tp , typename _Alloc > bool operator!= (const list< _Tp, _Alloc > &__lhs, const list< _Tp, _Alloc > &__rhs) template<size_t _Nb> bitset< _Nb > operator& (const bitset< _Nb > &__x, const bitset< _Nb > &__y) template<typename _Key , typename _Compare , typename _Allocator > bool operator< (const multiset< _Key, _Compare, _Allocator > &__lhs, const multiset< _Key, _Compare, _Allocator > &__rhs) template<typename _Key , typename _Compare , typename _Allocator > bool operator< (const set< _Key, _Compare, _Allocator > &__lhs, const set< _Key, _Compare, _Allocator > &__rhs) template<typename _Key , typename _Tp , typename _Compare , typename _Allocator > bool operator< (const multimap< _Key, _Tp, _Compare, _Allocator > &__lhs, const multimap< _Key, _Tp, _Compare, _Allocator > &__rhs) template<typename _Key , typename _Tp , typename _Compare , typename _Allocator > bool operator< (const map< _Key, _Tp, _Compare, _Allocator > &__lhs, const map< _Key, _Tp, _Compare, _Allocator > &__rhs) template<typename _Tp , typename _Alloc > bool operator< (const deque< _Tp, _Alloc > &__lhs, const deque< _Tp, _Alloc > &__rhs) template<typename _Tp , typename _Alloc > bool operator< (const vector< _Tp, _Alloc > &__lhs, const vector< _Tp, _Alloc > &__rhs) template<typename _Tp , typename _Alloc > bool operator< (const forward_list< _Tp, _Alloc > &__lx, const forward_list< _Tp, _Alloc > &__ly) template<typename _Tp , typename _Alloc > bool operator< (const list< _Tp, _Alloc > &__lhs, const list< _Tp, _Alloc > &__rhs) template<typename _CharT , typename _Traits , size_t _Nb> std::basic_ostream< _CharT, _Traits > & operator<< (std::basic_ostream< _CharT, _Traits > &__os, const bitset< _Nb > &__x)" template<typename _Key , typename _Compare , typename _Allocator > bool operator<= (const multiset< _Key, _Compare, _Allocator > &__lhs, const multiset< _Key, _Compare, _Allocator > &__rhs) template<typename _Key , typename _Compare , typename _Allocator > bool operator<= (const set< _Key, _Compare, _Allocator > &__lhs, const set< _Key, _Compare, _Allocator > &__rhs) template<typename _Key , typename _Tp , typename _Compare , typename _Allocator > bool operator<= (const multimap< _Key, _Tp, _Compare, _Allocator > &__lhs, const multimap< _Key, _Tp, _Compare, _Allocator > &__rhs) template<typename _Key , typename _Tp , typename _Compare , typename _Allocator > bool operator<= (const map< _Key, _Tp, _Compare, _Allocator > &__lhs, const map< _Key, _Tp, _Compare, _Allocator > &__rhs) template<typename _Tp , typename _Alloc > bool operator<= (const deque< _Tp, _Alloc > &__lhs, const deque< _Tp, _Alloc > &__rhs) template<typename _Tp , typename _Alloc > bool operator<= (const vector< _Tp, _Alloc > &__lhs, const vector< _Tp, _Alloc > &__rhs) template<typename _Tp , typename _Alloc > bool operator<= (const forward_list< _Tp, _Alloc > &__lx, const forward_list< _Tp, _Alloc > &__ly) template<typename _Tp , typename _Alloc > bool operator<= (const list< _Tp, _Alloc > &__lhs, const list< _Tp, _Alloc > &__rhs) template<typename _Value , typename _Hash , typename _Pred , typename _Alloc > bool operator== (const unordered_set< _Value, _Hash, _Pred, _Alloc > &__x, const unordered_set< _Value, _Hash, _Pred, _Alloc > &__y) template<typename _Key , typename _Tp , typename _Hash , typename _Pred , typename _Alloc > bool operator== (const unordered_map< _Key, _Tp, _Hash, _Pred, _Alloc > &__x, const unordered_map< _Key, _Tp, _Hash, _Pred, _Alloc > &__y) template<typename _Key , typename _Compare , typename _Allocator > bool operator== (const multiset< _Key, _Compare, _Allocator > &__lhs, const multiset< _Key, _Compare, _Allocator > &__rhs) template<typename _Key , typename _Compare , typename _Allocator > bool operator== (const set< _Key, _Compare, _Allocator > &__lhs, const set< _Key, _Compare, _Allocator > &__rhs) template<typename _Key , typename _Tp , typename _Compare , typename _Allocator > bool operator== (const multimap< _Key, _Tp, _Compare, _Allocator > &__lhs, const multimap< _Key, _Tp, _Compare, _Allocator > &__rhs) template<typename _Key , typename _Tp , typename _Compare , typename _Allocator > bool operator== (const map< _Key, _Tp, _Compare, _Allocator > &__lhs, const map< _Key, _Tp, _Compare, _Allocator > &__rhs) template<typename _Tp , typename _Alloc > bool operator== (const deque< _Tp, _Alloc > &__lhs, const deque< _Tp, _Alloc > &__rhs) template<typename _Tp , typename _Alloc > bool operator== (const vector< _Tp, _Alloc > &__lhs, const vector< _Tp, _Alloc > &__rhs) template<typename _Value , typename _Hash , typename _Pred , typename _Alloc > bool operator== (const unordered_multiset< _Value, _Hash, _Pred, _Alloc > &__x, const unordered_multiset< _Value, _Hash, _Pred, _Alloc > &__y) template<typename _Key , typename _Tp , typename _Hash , typename _Pred , typename _Alloc > bool operator== (const unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc > &__x, const unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc > &__y) template<typename _Tp , typename _Alloc > bool operator== (const forward_list< _Tp, _Alloc > &__lx, const forward_list< _Tp, _Alloc > &__ly) template<typename _Tp , typename _Alloc > bool operator== (const list< _Tp, _Alloc > &__lhs, const list< _Tp, _Alloc > &__rhs) template<typename _Key , typename _Compare , typename _Allocator > bool operator> (const multiset< _Key, _Compare, _Allocator > &__lhs, const multiset< _Key, _Compare, _Allocator > &__rhs) template<typename _Key , typename _Compare , typename _Allocator > bool operator> (const set< _Key, _Compare, _Allocator > &__lhs, const set< _Key, _Compare, _Allocator > &__rhs) template<typename _Key , typename _Tp , typename _Compare , typename _Allocator > bool operator> (const multimap< _Key, _Tp, _Compare, _Allocator > &__lhs, const multimap< _Key, _Tp, _Compare, _Allocator > &__rhs) template<typename _Key , typename _Tp , typename _Compare , typename _Allocator > bool operator> (const map< _Key, _Tp, _Compare, _Allocator > &__lhs, const map< _Key, _Tp, _Compare, _Allocator > &__rhs) template<typename _Tp , typename _Alloc > bool operator> (const deque< _Tp, _Alloc > &__lhs, const deque< _Tp, _Alloc > &__rhs) template<typename _Tp , typename _Alloc > bool operator> (const vector< _Tp, _Alloc > &__lhs, const vector< _Tp, _Alloc > &__rhs) template<typename _Tp , typename _Alloc > bool operator> (const forward_list< _Tp, _Alloc > &__lx, const forward_list< _Tp, _Alloc > &__ly) template<typename _Tp , typename _Alloc > bool operator> (const list< _Tp, _Alloc > &__lhs, const list< _Tp, _Alloc > &__rhs) template<typename _Key , typename _Compare , typename _Allocator > bool operator>= (const multiset< _Key, _Compare, _Allocator > &__lhs, const multiset< _Key, _Compare, _Allocator > &__rhs) template<typename _Key , typename _Compare , typename _Allocator > bool operator>= (const set< _Key, _Compare, _Allocator > &__lhs, const set< _Key, _Compare, _Allocator > &__rhs) template<typename _Key , typename _Tp , typename _Compare , typename _Allocator > bool operator>= (const multimap< _Key, _Tp, _Compare, _Allocator > &__lhs, const multimap< _Key, _Tp, _Compare, _Allocator > &__rhs) template<typename _Key , typename _Tp , typename _Compare , typename _Allocator > bool operator>= (const map< _Key, _Tp, _Compare, _Allocator > &__lhs, const map< _Key, _Tp, _Compare, _Allocator > &__rhs) template<typename _Tp , typename _Alloc > bool operator>= (const deque< _Tp, _Alloc > &__lhs, const deque< _Tp, _Alloc > &__rhs) template<typename _Tp , typename _Alloc > bool operator>= (const vector< _Tp, _Alloc > &__lhs, const vector< _Tp, _Alloc > &__rhs) template<typename _Tp , typename _Alloc > bool operator>= (const forward_list< _Tp, _Alloc > &__lx, const forward_list< _Tp, _Alloc > &__ly) template<typename _Tp , typename _Alloc > bool operator>= (const list< _Tp, _Alloc > &__lhs, const list< _Tp, _Alloc > &__rhs) template<typename _CharT , typename _Traits , size_t _Nb> std::basic_istream< _CharT, _Traits > & operator>> (std::basic_istream< _CharT, _Traits > &__is, bitset< _Nb > &__x)" template<size_t _Nb> bitset< _Nb > operator^ (const bitset< _Nb > &__x, const bitset< _Nb > &__y) template<size_t _Nb> bitset< _Nb > operator| (const bitset< _Nb > &__x, const bitset< _Nb > &__y) template<typename _Value , typename _Hash , typename _Pred , typename _Alloc > void swap (unordered_set< _Value, _Hash, _Pred, _Alloc > &__x, unordered_set< _Value, _Hash, _Pred, _Alloc > &__y) template<typename _Key , typename _Tp , typename _Hash , typename _Pred , typename _Alloc > void swap (unordered_map< _Key, _Tp, _Hash, _Pred, _Alloc > &__x, unordered_map< _Key, _Tp, _Hash, _Pred, _Alloc > &__y) template<typename _Key , typename _Compare , typename _Allocator > void swap (multiset< _Key, _Compare, _Allocator > &__x, multiset< _Key, _Compare, _Allocator > &__y) template<typename _Key , typename _Compare , typename _Allocator > void swap (set< _Key, _Compare, _Allocator > &__x, set< _Key, _Compare, _Allocator > &__y) template<typename _Key , typename _Tp , typename _Compare , typename _Allocator > void swap (multimap< _Key, _Tp, _Compare, _Allocator > &__lhs, multimap< _Key, _Tp, _Compare, _Allocator > &__rhs) template<typename _Key , typename _Tp , typename _Compare , typename _Allocator > void swap (map< _Key, _Tp, _Compare, _Allocator > &__lhs, map< _Key, _Tp, _Compare, _Allocator > &__rhs) template<typename _Tp , typename _Alloc > void swap (deque< _Tp, _Alloc > &__lhs, deque< _Tp, _Alloc > &__rhs) template<typename _Value , typename _Hash , typename _Pred , typename _Alloc > void swap (unordered_multiset< _Value, _Hash, _Pred, _Alloc > &__x, unordered_multiset< _Value, _Hash, _Pred, _Alloc > &__y) template<typename _Tp , typename _Alloc > void swap (vector< _Tp, _Alloc > &__lhs, vector< _Tp, _Alloc > &__rhs) template<typename _Key , typename _Tp , typename _Hash , typename _Pred , typename _Alloc > void swap (unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc > &__x, unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc > &__y) template<typename _Tp , typename _Alloc > void swap (forward_list< _Tp, _Alloc > &__lx, forward_list< _Tp, _Alloc > &__ly) template<typename _Tp , typename _Alloc > void swap (list< _Tp, _Alloc > &__lhs, list< _Tp, _Alloc > &__rhs) Detailed Description GNU debug code, replaces standard behavior with debug behavior. Macros and namespaces used by the implementation outside of debug wrappers to verify certain properties. The __glibcxx_requires_xxx macros are merely wrappers around the __glibcxx_check_xxx wrappers when we are compiling with debug mode, but disappear when we are in release mode so that there is no checking performed in, e.g., the standard library algorithms. Function Documentation template<typename _Tp , typename _Alloc > bool std::__debug::operator<= (const forward_list< _Tp, _Alloc > &__lx, const forward_list< _Tp, _Alloc > &__ly) [inline] Based on operator<. Definition at line 712 of file debug/forward_list. template<typename _Tp , typename _Alloc > bool std::__debug::operator> (const forward_list< _Tp, _Alloc > &__lx, const forward_list< _Tp, _Alloc > &__ly) [inline] Based on operator<. Definition at line 698 of file debug/forward_list. template<typename _Tp , typename _Alloc > bool std::__debug::operator>= (const forward_list< _Tp, _Alloc > &__lx, const forward_list< _Tp, _Alloc > &__ly) [inline] Based on operator<. Definition at line 705 of file debug/forward_list. template<typename _Tp , typename _Alloc > void std::__debug::swap (forward_list< _Tp, _Alloc > &__lx, forward_list< _Tp, _Alloc > &__ly) [inline] See std::forward_list::swap(). Definition at line 719 of file debug/forward_list. Author Generated automatically by Doxygen for libstdc++ from the source code. libstdc++ Tue Nov 27 2012 std::__debug(3cxx)
All times are GMT -4. The time now is 03:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy