0

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

3
Contributors
4
Replies
6
Views
7 Years
Discussion Span
Last Post by Ancient Dragon
0

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

0

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);
}

Edited by Ancient Dragon: n/a

0

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

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.