How Can I Work with a Set of Vectors??

Oct 25, 2011 at 2:39pm
I want to put some very big numbers into some vectors like this for example :

|1|2|3|4|5|6|7|8|9|8|7|6|5|4|3|2|1| = 12345678987654321

(because I can't store very big numbers in normal variables)

then put these vectors in a set to get the repeated numbers deleted.

But How Can I Work with a Set of Vectors??
Oct 25, 2011 at 4:21pm
I don't get it, you want to put some very big numbers in a vector and then use them correct? You realise you have to figure out how to handle this numbers as the default implementation won't do (since as you say
I can't store very big numbers in normal variables
). Anyway let's say you find a way.

You need to be sure that each element of a vector is stored successively. I am not sure it does. And I think that it has to do with the architecture of your machine (how does it store each number). So probably it's not portable either (even if it works in your machine it's not guaranteed to work in others also).

And don't think that arrays are better! They do store successively but they also are machine dependent.

Are you sure you can't use long long for example?
Oct 25, 2011 at 4:59pm
Forget those stuff.
Look at this code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include<iostream>
#include<vector>
#include<set>
using namespace std;
int main(){
    vector<int>v1(10,5);
    vector<int>v2(10,5);
    vector<int>v3(5,5);
    vector<int>v4(10);
    vector<int>v5;
    set<vector<int> >s;
    s.insert(v1);
    s.insert(v2);
    s.insert(v3);
    s.insert(v4);
    s.insert(v5);
    cout<<s.size()<<endl;
    system("pause");
    return 0;
}

Now how can I show what's in the vectors that are in my Set?
How can I change the values an stuff like this?
And by the the way thanks for replying! :D
Topic archived. No new replies allowed.