Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8562039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:38:31+00:00 2026-06-11T16:38:31+00:00

I’m trying to map::insert a key datatype I define (miniVec2ui).. It Breaks during a

  • 0

I’m trying to map::insert a key datatype I define (miniVec2ui).. It Breaks during a compare (it has bogus data when comparing).. It’s using the standard less functor (i tried with my own, but same problem) – it’s passing rhs.x = ??? and rhs.y = ??? basically. The code is below

miniVec2ui v233 = miniVec2ui(x,y);

m_pIdMap->insert(std::pair<miniVec2ui,uint>(v233,(uint)tmpPF.id));// std::pair<const miniVec2ui,uint>(v233, (uint)tmpPF.id) );
//////in other files I defined miniVec2ui,etc. (uint = unsigned int), tmpPF.id unimportant here, uint x; uint y;



typedef std::map<miniVec2ui,uint>       eIdMap;
eIdMap  *m_pIdMap;
m_pIdMap =      new eIdMap;//new std::map<miniVec2ui, uint >;
struct miniVec2ui {
    uint x;
    uint y;
    miniVec2ui(uint inx, uint iny):
                x(inx)
                ,y(iny) { }

    bool operator==(const miniVec2ui& rhs) const {
        return ((x == rhs.x) && (y == rhs.y));
    }
    bool operator!=(const miniVec2ui& rhs) const {
        return ( (x != rhs.x) || (y != rhs.y) );
    }

    bool operator< (const miniVec2ui& rhs) const {
        return ((x < rhs.x) && (y < rhs.y));

   }
    bool operator> (const miniVec2ui& rhs) const {
        return ((x > rhs.x) && (y > rhs.y));
    }

};

Specifically – breaking in _function_base.h with __y is {x=???,y=???}… here’s the disassembly:

...stuff...
#endif

{
  bool operator()(const _Tp& __x, const _Tp& __y) const { return __x < __y; }
200439C0 55                   push        ebp  
200439C1 8B EC                mov         ebp,esp  
200439C3 81 EC CC 00 00 00    sub         esp,0CCh  
200439C9 53                   push        ebx  
200439CA 56                   push        esi  
200439CB 57                   push        edi  
200439CC 51                   push        ecx  
200439CD 8D BD 34 FF FF FF    lea         edi,[ebp-0CCh]  
200439D3 B9 33 00 00 00       mov         ecx,33h  
200439D8 B8 CC CC CC CC       mov         eax,0CCCCCCCCh  
200439DD F3 AB                rep stos    dword ptr es:[edi]  
200439DF 59                   pop         ecx  
200439E0 89 4D F8             mov         dword ptr [ebp-8],ecx  
200439E3 8B 45 0C             mov         eax,dword ptr [__y]  
200439E6 50                   push        eax  
200439E7 8B 4D 08             mov         ecx,dword ptr [__x]  
200439EA E8 67 84 F1 FF       call        miniVec2ui::operator< (1FF5BE56h)  
200439EF 5F                   pop         edi   <--------------------- HERE ---------- <<
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:38:32+00:00Added an answer on June 11, 2026 at 4:38 pm

    I have no idea if it is related to the error you are finding, but your less-than comparison is supposed to implement strict weak ordering, and it doesn’t:

    bool operator< (const miniVec2ui& rhs) const {
        return ((x < rhs.x) && (y < rhs.y));
    }
    

    By this logic, m1 is not less than m2, and m2 is not less than m1:

    miniVec2ui m1(5,5);
    miniVec2ui m2(6,5);
    std::cout << std::boolalpha;
    std::cout << m1 < m2 << "\n";
    std::cout << m2 < m1 << "\n";
    

    std::map uses this condition to determine whether two elements are equal. You probably need something like

    bool operator< (const miniVec2ui& rhs) const {
        if (x == rhs.x) return y < rhs.y;
        return x < rhs.x;
    }
    

    You should try to implement operator> in terms of operator< and operator!= in terms of operator==.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am trying to render a haml file in a javascript response like so:
In my XML file chapters tag has more chapter tag.i need to display chapters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.