I have seen this discussion (Concatenating two std::vectors) but it concerns combining (as in moving) two std::vector arrays.
I have three std::vectors and I am using C++17:
- m_mapHist[m_eHistAssign][strName]
- m_mapScheduleHist[m_eHistAssign][strName]
- m_mapScheduleFutureHist[m_eHistAssign][strName]
Each vector is of type std::vector<COleDateTime>. I don't want to change these vectors. Instead, I want to combine them (copy I guess) into a temporary single vector, so I can pass just the one vector to another class for processing.
At the moment I am doing this manually through iteration:
std::vector<COleDateTime> vecAssignmentDate;
// Past items from the history database
if (m_mapHist[m_eHistAssign].find(strName) != m_mapHist[m_eHistAssign].end())
{
    for (const auto& historyItemDate : m_mapHist[m_eHistAssign][strName])
    {
        vecAssignmentDate.push_back(historyItemDate);
    }
}
// Past items on the active schedule
if (m_mapScheduleHist[m_eHistAssign].find(strName) != m_mapScheduleHist[m_eHistAssign].end())
{
    for (const auto& historyItemDate : m_mapScheduleHist[m_eHistAssign][strName])
    {
        vecAssignmentDate.push_back(historyItemDate);
    }
}
// Future items (both on the active schedule and in the history database)
if (m_mapScheduleFutureHist[m_eHistAssign].find(strName) != m_mapScheduleFutureHist[m_eHistAssign].end())
{
    for(const auto &historyItemDate : m_mapScheduleFutureHist[m_eHistAssign][strName])
    {
        vecAssignmentDate.push_back(historyItemDate);
    }
}
Is there an easier way to create this temporary vector?
 
     
     
    