### Trying to obtain 3D vector with multiple 2D vectors

Hello fellows. I am trying to push_back 2D matrices I obtained from ontain function and I need to have 3D vector by adding these 2D vectors. TO do so, I coded as follows but I could not achieve it. 3D1.push_back and 3D2.push_back are underlined in main function. I will be very happy if you can help me to fix it.
Thank you so much
 ``1234567891011121314151617181920212223242526272829303132`` ``````#include #include #include using namespace std; std::tuple>, std::vector>> obtain(); int main() { std::tuple>, std::vector>> c; vector>>3D1; vector>>3D2; for (int kk=0; kk<3;kk++) { c = obtain(); 3D1.push_back(get<0>(c)); 3D2.push_back(get<1>(c)); } } std::tuple, double, std::vector>> obtain() { std::vector> v2d1 {{ 6, 7, 13 },{ 2, 4, 6 } }; std::vector> v2d2 { { 1, 3, 5 }, { 2, 4, 6 } }; return std::make_tuple(v2d1, v2d2); } ``````
Last edited on
You have conflicting definitions of obtain().
For brevity, I will abbreviate:
tuple --> T
vector<int> -> VI
vector<vector<int>> --> VVI

Line 3: obtain shall return a T<VVI, VVI>
Line 9: c is a T<VI, double, VVI>
Line 16: type(c) != type(obtain())
Line 23: obtain shall return a T<VI, double, VVI>
Line 24: You are making a T<VVI, VVI>
Thank you @Ganado, it was copy-paste mistake. It has been corrected now
Oh, you're gonna laugh. You can't start a variable name with a number :)
Last edited on
@Ganado. Thanks you so much :) It is really funny :) I could not see it sorry , thank you so much
Topic archived. No new replies allowed.