#include <vector>
#include <array>
#include <algorithm>
#include <iostream>
using namespace std;
int main( )
{
vector< vector< vector< int >> > collection;
array< array< int , 5 > , 5 > arr { { { 1 ,2 } ,{ 2 ,3 } ,{ 2 ,4 } ,{ 3 ,5 } ,{ 4 ,999 } } } ;
vector< vector< int >> vec( arr.size ( ) ) ;
transform( arr.begin ( ) , arr.end ( ) , vec.begin ( ) , [ ] ( auto & rer) {
return vector< int > ( rer.begin ( ) , rer.end ( ) ) ;
} ) ;
collection.push_back ( vec) ;
printf ( "элемент вектора = %i\n " ,vec[ 4 ] [ 1 ] ) ;
printf ( "элемент коллекции = %i\n " ,collection[ 0 ] [ 4 ] [ 1 ] ) ;
array< array< int , 10 > , 10 > arr2 { { { 1 ,2 } ,{ 2 ,3 } ,{ 2 ,4 } ,{ 3 ,5 } ,{ 4 ,9000 } ,{ 5 ,10000 } } } ;
vector< vector< int >> vec2( arr2.size ( ) ) ;
transform( arr2.begin ( ) , arr2.end ( ) , vec2.begin ( ) , [ ] ( auto & a) {
return vector< int > ( a.begin ( ) , a.end ( ) ) ;
} ) ;
printf ( "тот же элемент второго вектора = %i\n " ,vec2[ 4 ] [ 1 ] ) ;
collection[ 0 ] = vec2;
printf ( "тот же элемент перезаписанной коллекции = %i\n " ,collection[ 0 ] [ 4 ] [ 1 ] ) ;
printf ( "последующий элемент (collection сам расширился \\ o/) = %i\n " ,collection[ 0 ] [ 5 ] [ 1 ] ) ;
return 0 ;
}
ICAgICNpbmNsdWRlIDx2ZWN0b3I+CiAgICAjaW5jbHVkZSA8YXJyYXk+CiAgICAjaW5jbHVkZSA8YWxnb3JpdGhtPgogICAgI2luY2x1ZGUgPGlvc3RyZWFtPgogICAgdXNpbmcgbmFtZXNwYWNlIHN0ZDsKICAgICAKICAgIGludCBtYWluKCkKICAgIHsKICAgCiAgICAgICAgdmVjdG9yPCB2ZWN0b3I8dmVjdG9yPGludD4+ID4gY29sbGVjdGlvbjsKCQkKCQlhcnJheTxhcnJheTxpbnQsIDU+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