std::find

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter Meier

    std::find

    Hello,

    I have a question. I have the following construct:

    std::vector < std::vector < std::vector< AsMarkerMatchMa trix >> >
    m_matchMatrices ;

    If I run a std::find on that I sometimes get the iterator to be some strange
    number like -124224256, although I know there should not be a match. Usually
    the iterator points to NULL, if there is no match.

    Anybody experienced the problem? MS c++ 7.1

    Also I get an "could not deduce template argument" error, if I do not
    implement the == operator, although the parent class implements it.

    Greetings, Peter




  • Mike Wahler

    #2
    Re: std::find


    "Peter Meier" <peter.meier@ ar-solutions.de> wrote in message
    news:blgkto$sv5 $1@wsc10.lrz-muenchen.de...[color=blue]
    > Hello,
    >
    > I have a question. I have the following construct:
    >
    > std::vector < std::vector < std::vector< AsMarkerMatchMa trix >> >
    > m_matchMatrices ;
    >
    > If I run a std::find on that I sometimes get the iterator to be some[/color]
    strange[color=blue]
    > number like -124224256, although I know there should not be a match.[/color]
    Usually[color=blue]
    > the iterator points to NULL, if there is no match.[/color]

    Show us a small compilable example that gives the
    problem behavior.
    [color=blue]
    > Anybody experienced the problem? MS c++ 7.1
    >
    > Also I get an "could not deduce template argument" error, if I do not
    > implement the == operator, although the parent class implements it.[/color]

    Show a small example that gives this error.

    My crystal ball rolled down the driveway and got hit by a car.

    -Mike



    Comment

    • Peter Meier

      #3
      Re: std::find

      Found the problem: I should compare with vector.end() to find out, if there
      was a match, but for the second question I did not find an answer.

      Greetings, Peter
      [color=blue]
      > Hello,
      >
      > I have a question. I have the following construct:
      >
      > std::vector < std::vector < std::vector< AsMarkerMatchMa trix >> >
      > m_matchMatrices ;
      >
      > If I run a std::find on that I sometimes get the iterator to be some[/color]
      strange[color=blue]
      > number like -124224256, although I know there should not be a match.[/color]
      Usually[color=blue]
      > the iterator points to NULL, if there is no match.
      >
      > Anybody experienced the problem? MS c++ 7.1
      >
      > Also I get an "could not deduce template argument" error, if I do not
      > implement the == operator, although the parent class implements it.
      >
      > Greetings, Peter
      >
      >
      >
      >[/color]


      Comment

      • Mike Wahler

        #4
        Re: std::find

        "Peter Meier" <peter.meier@ ar-solutions.de> wrote in message
        news:blgqga$2jf $1@wsc10.lrz-muenchen.de...[color=blue]
        > Found the problem: I should compare with vector.end() to find out, if[/color]
        there[color=blue]
        > was a match, but for the second question I did not find an answer.[/color]

        Please don't top-post.

        We cannot answer your question until you provide
        context (code).

        -Mike


        Comment

        Working...