How can you simulate a SQL connection in C ++ using STL and Boost

How can you simulate an SQL connection between two dynamic datasets (i.e. data received at runtime) using C ++.
Example. Table A is a 2D vector of vectors (any STL or Boost data structure is in order) of students, their names and course numbers. Table B is a two-dimensional vector of vectors (any STL or Boost data structure in order) course numbers, descriptions and number numbers

//Table A
// Columns: StudentID   FirstName   LastName    CourseNum
std::vector<std::string> a1 = boost::assign::list_of("3490")( "Saundra")( "Bribiesca")( "F100X");
std::vector<std::string> a2 = boost::assign::list_of("1288")( "Guy")( "Shippy")( "F103X");
std::vector<std::string> a3 = boost::assign::list_of("5383")( "Tia")( "Roache")( "F103X");
std::vector<std::string> a4 = boost::assign::list_of("5746")( "Jamie")( "Grunden")( "F101X");
std::vector<std::string> a5 = boost::assign::list_of("2341")( "Emilia")( "Hankinson")( "F120X");

std::vector<std::vector<std::string > > TableA = boost::assign::list_of(a1)(a2)(a3)(a4)(a5);

//Table B
//Columns: CourseNum    CourseDesc  Room
 std::vector<std::string> b1 = boost::assign::list_of("F100X")("Human Biology")("400B");
 std::vector<std::string> b2 = boost::assign::list_of("F103X")("Biology and Society")("500B");
 std::vector<std::string> b3 = boost::assign::list_of("F101X")("The Dynamic Earth 340A");
 std::vector<std::string> b4 = boost::assign::list_of("F120X")("Glaciers, Earthquakes and Volcanoes")("300C");Earthquakes and Volcanoes");


 std::vector<std::vector<std::string > > TableB = boost::assign::list_of(b1)(b2)(b3)(b4);

  //Table C ( result of joining A and B ) using TableA[3] and TableB[0] as key
//I want to produce a resultset Table C, like this


Table c
StudentID FirstName LastName Room CourseNum CourseDesc
3490 Saundra Bribiesca 400B F100X Human Biology
1288 Guy Shippy 500B F103X Biology and Society
5383 Tia Roache 500B F103X Biology and Society
5746    Jamie   Grunden 340A    F101X   The Dynamic Earth
2341    Emilia  Hankinson    300C   F120X   Glaciers, Earthquakes and Volcanoes
+3
2

SQL- , , ( -, , , " " ).

, O (N * M) . , , A B. , .

, "" B , std::multimap [*] of . . CourseNum B, , map, multimap.

O(N*M) O((N+M)*logM), , N ( A) . , , - , -)

[*], "" , - , .

+4

... ooooold Q.
, ( )

int main()
{  
    map<string,std::vector<vector<string > >::const_iterator> mapB;
    for(auto it = TableB.cbegin(); it!=TableB.cend(); ++it)
    { 
        mapB[(*it)[0]]=it;// in first map we put primary key and iterator to tableB where that key is
    }
    assert(mapB.size()== TableB.size());// how unique is primary key?
    for_each(TableA.cbegin(), TableA.cend(),
    [&mapB] (const vector<string>& entryA )
    {
        auto itB= mapB.find(entryA.at(3));
        if (itB!=mapB.end()) // if we can make "JOIN"  we do it
        {
            auto entryB = itB->second;
            cout << entryA.at(0) << " " << entryA.at(1) << "  " << entryA.at(2) << "  " << entryB->at(2) << "  " << entryB->at(0) << "  " << entryB->at(1) << endl;
        }
    });
}

:

C:\STL\MinGW > g++ test.cpp & a.exe

3490 Saundra  Bribiesca  400B  F100X  Human Biology  
1288 Guy  Shippy  500B  F103X  Biology and Society  
5383 Tia  Roache  500B  F103X  Biology and Society  
5746 Jamie  Grunden  340A  F101X  The Dynamic Earth  
2341 Emilia  Hankinson  300C  F120X  Glaciers, Earthquakes and Volcanoes  
+2

All Articles