Re: std::rel_ops

Discussion in 'C++' started by Victor Bazarov, Jul 1, 2003.

  1. "Davis King" <-state.edu> wrote...
    >
    >
    > Davis King wrote:
    > > Why aren't the templates in std::rel_ops implemented like
    > > template <typename A, typename B> bool operator> (const A& a, const B&
    > > b) { return b < a; }
    > > ?

    >
    > Let explain what my problem is exactly.
    > I'm making a bigint object and I have operator<(const bigint&) and then
    > two global friends called operator<(int,const bigint&) and
    > operator<(const bigint&,int).
    >
    > I also have similar operator== functions.
    >
    >
    > Anyways.
    > my problem is that the std::rel_ops operators only work when the types
    > being compared are the same. So if I create the above templated compare
    > then everything SEEMS to work just fine and I can compare my bigints to
    > ints all I please. However, since the rel::eek:ps aren't implemented
    > this way it makes me worried that there is some bizarre behavior caused
    > by doing this that I don't know about.
    >
    > So am I worried over nothing?


    Could be. The best place to ask for rationale behind some Standard
    definitions is comp.std.c++. [ I thought you knew ]

    Victor
    Victor Bazarov, Jul 1, 2003
    #1
    1. Advertising

  2. Victor Bazarov

    Davis King Guest

    Victor Bazarov wrote:
    > "Davis King" <-state.edu> wrote...
    >
    >>

    > Could be. The best place to ask for rationale behind some Standard
    > definitions is comp.std.c++. [ I thought you knew ]
    >


    I know now. Thanks :)
    Davis King, Jul 1, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dhruv

    Re: std::rel_ops

    Dhruv, Jul 1, 2003, in forum: C++
    Replies:
    2
    Views:
    458
    Dhruv
    Jul 1, 2003
  2. Peter Jansson
    Replies:
    5
    Views:
    6,295
    Ivan Vecerina
    Mar 17, 2005
  3. Vinu
    Replies:
    4
    Views:
    353
    Jim Langston
    Jul 7, 2005
  4. Vinu
    Replies:
    0
    Views:
    351
  5. Replies:
    0
    Views:
    372
Loading...

Share This Page