2D vector data types should be different or same only ..
for ex::
for one sub script with int data type and with another subscript with class name is it possible to declare with diff. data types

Recommended Answers

All 4 Replies

There are no 2D vector types in standard C++. There are only vectors of vectors (or vectors of maps, or whatever).

Yes, the vector can hold items of random data types

#include <vector>
#include <string>

int main()
{
    int a = 0;
    float b = 1.2F;
    std::string hello = "Hello";
    std::vector<void*> list;
    list.push_back(&a);
    list.push_back(&b);
    list.push_back(&hello);
}

actually in my project i am using vectors...

when i am storing data in vector, through that data in vector i am transfering to
another system.....

after transfering data i am erasing data from vector immediately..

at the time of storing different data reports at the same time and transfering data, the two different data reports are taking as same report

Using pointers as in my example won't work. How is the data going to be transferred to another system (computer)? Maybe vectors isn't the best way to do that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.