0

i have a struct that takes 3 variables, than i proceed to make a std::map composed of this struct and a std::vector see below:

jay::spr_id::spr_id(unsigned int ispr_inx, unsigned int iscl_inx, bool itype_spr)
{
    unsigned int spr_inx = ispr_inx;
    unsigned int scl_inx = iscl_inx;
    bool type_spr = itype_spr;
};

here is the std::map that uses the struct, be below:

std::map<jay::spr_id, std::vector<sf::Sprite>> Bge::l_Sprites;

here is the line that causes the error, this is a function that returns a reference to a sprite, ill leave off the extra code, see below:

sf::Sprite& Bge::getSprite(jay::spr_id id, int img_inx)
{
    auto sprFound = l_Sprites.find(id);// this triggers the error

    // the rest of the code down here....
}

I need help figuring out how to fix this error is way over my head.

Thanks in advance!

  • 1
    And your `operator<` overload for your `jay::spr_id` is...? You are aware of all the requirements for a type that's used for a `std::map` key, right? So, how exactly did you implement strict weak ordering for this particular class? – Sam Varshavchik May 20 '18 at 00:19
  • thanks for the hand @SamVarshavchik, im new to the language so any little bit of info goes a long way for me. – CPPapprentice May 20 '18 at 00:42

0 Answers0