std::vector and operator==

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tom Smith

    #1

    std::vector and operator==

    How does operator== work for std::vector (or in fact for any standard
    container?). My guess would be that it v == w returns true iff v.size() =
    w.size() and v[n]==w[n] for all valid n. Is this true? I've looked in the SGI
    documentation (which was mystifying) and in TiC2 (which didn't help).

    Thanks!

    Tom
  • Mark P

    #2
    Re: std::vector and operator==

    Tom Smith wrote:
    How does operator== work for std::vector (or in fact for any standard
    container?). My guess would be that it v == w returns true iff v.size()
    = w.size() and v[n]==w[n] for all valid n. Is this true? I've looked in
    the SGI documentation (which was mystifying) and in TiC2 (which didn't
    help).
    >
    Thanks!
    >
    Tom
    The SGI docs seem pretty clear to me:

    http://www.sgi.com/tech/stl/ForwardContainer.html

    Comment

    • Tom Smith

      #3
      Re: std::vector and operator==

      Mark P wrote:
      Tom Smith wrote:
      >How does operator== work for std::vector (or in fact for any standard
      >container?). My guess would be that it v == w returns true iff
      >v.size() = w.size() and v[n]==w[n] for all valid n. Is this true? I've
      >looked in the SGI documentation (which was mystifying) and in TiC2
      >(which didn't help).
      >>
      >Thanks!
      >>
      >Tom
      >
      The SGI docs seem pretty clear to me:
      >
      http://www.sgi.com/tech/stl/ForwardContainer.html
      Gosh, you're right. I stopped reading just before the relevant section because I
      couldn't make head or tail of it - that'll teach me.

      Thanks,


      Tom

      Comment

      Working...