Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing data inside std::vector container

Tags:

c++

std

stdvector

I have three std::vector.

typedef std::pair< double,double > A;
typedef std::vector< A > B;
typedef std::vector< B > C;

I know how to access the element inside B like

B b;
b.at(0).first;
b.at(0).second;
And
C c;

How can I access the element of b using the container variable c? Thanks

like image 490
batuman Avatar asked Mar 04 '26 04:03

batuman


1 Answers

C.at(0).at(0) will access first element of B. Because C is B's container.

like image 105
Pranit Kothari Avatar answered Mar 05 '26 17:03

Pranit Kothari



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!