C++ c++;将结构用作a<;的数据;地图,<;地图、矢量>&燃气轮机;

C++ c++;将结构用作a<;的数据;地图,<;地图、矢量>&燃气轮机;,c++,dictionary,vector,struct,C++,Dictionary,Vector,Struct,我在尝试加载一个映射时遇到了一个问题,该映射具有另一个映射/向量组合作为structs的值。下面是我尽量简化的代码: //These are the structs struct Order { std::string A; std::string B; }; struct Card { std::string C; std::string D; }; struc

我在尝试加载一个映射时遇到了一个问题,该映射具有另一个映射/向量组合作为structs的值。下面是我尽量简化的代码:

    //These are the structs
    struct Order 
    {
        std::string A;
        std::string B;
    };

    struct Card
    {
        std::string C;
        std::string D;
    };

    struct Item  
    {
        std::string E;
        std::string F;
    };

    //this is the method that will read and load the map
    void LoadMap(ListofValues object)
    {
    std::map<Order, std::map<Item, std::vector<Card>>> records; //THIS is the data structure I'm trying to store into

    //ListofValues is a list passed that holds all these values that will need to be put into my map
    for(std::vector<ListofValues>::iterator vIter= object.begin(); vIter != object.end(); ++vIter)
            {           
                std::string sReceiptRecord = (*vIter).getReceipt(m_StdOrderConfirmVer);

                Order order = {(*vIter).getA,(*vIter).getB}; 
                Item item = {(*vIter).getC,(*vIter).getD}; 
                Card card = {wws::String((*vIter).getE), (*vIter).getF}; 

                records[order][item].push_back(card); //load into my map            
            }
      }
//这些是结构
结构顺序
{
std::字符串A;
std::字符串B;
};
结构卡
{
std::字符串C;
std::字符串D;
};
结构项
{
std::字符串E;
std::字符串F;
};
//这是将读取和加载地图的方法
void LoadMap(ListofValues对象)
{
std::map records;//这是我试图存储到的数据结构
//ListofValues是一个传递的列表,其中包含所有需要放入地图的值
对于(std::vector::iterator vIter=object.begin();vIter!=object.end();++vIter)
{           
std::string sReceiptRecord=(*vIter).getReceipt(m_StdOrderConfirmVer);
顺序={(*vIter.getA,(*vIter.getB};
Item={(*vIter.getC,(*vIter.getD};
Card Card={wws::String((*vIter.getE),(*vIter.getF};
记录[订单][项目]。推回(卡片);//加载到我的地图
}
}
因此,我将传递一个包含所有值列表的对象(ListofValues)。我将遍历该列表,并使用getter方法将这些值存储到结构中(getE返回一个Long值,这就是为什么需要进行转换)。有我错过的一步吗

我得到的一个错误是:

error C2678: binary '<' : no operator found which takes a left-hand operand of type 'const Order' (or there is no acceptable conversion)

错误C2678:binary'您需要提供一个运算符,<对于要用作映射键的结构,请参见此问题:

ListOfValues
是传递给
LoadMap
的参数类型,
object
是实际变量

在for循环中,需要说出
object.begin()
object.end()

我得到的编译器错误与你说的完全不同。你发对代码了吗


以下是我看到的:

请发布一条消息。你有一个编译器错误,如果我把你的代码照原样处理,我会有很多错误。我想你需要一个不确定他是如何得到他声称的错误的操作符——他正在调用他传入的变量类型的.begin()和.end()。真的需要MCVE@OP看见同样的错误,示例已经完成。所有C++错误都可以用一个简单的例子来重新创建,并且你应该把代码分解下来发现是什么引起了问题,而不是有向量,<代码>字符串
,迭代器等等。对不起,我把自己弄糊涂了,同时试图把具体代码翻译成更简洁、更通用的代码。为了得到相关的部分,我不得不拿出大约一百行。