c++ primer statement about vectors containing vectors

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pauldepstein@att.net

    c++ primer statement about vectors containing vectors

    C++ Primer by Lippman, Lajoie and Moo seems to object to code like
    std::vector<std ::vector<double >something;

    The concern is that >will be interpreted as a shift operator and the
    code will not compile. However, I have seen no problems with this
    type of code and our company happily seems to accept code like the
    above with no spaces between the two characters.

    Is the above code a real problem or not?

    Thanks,

    Paul Epstein
  • red floyd

    #2
    Re: c++ primer statement about vectors containing vectors

    pauldepstein@at t.net wrote:
    C++ Primer by Lippman, Lajoie and Moo seems to object to code like
    std::vector<std ::vector<double >something;
    >
    The concern is that >will be interpreted as a shift operator and the
    code will not compile. However, I have seen no problems with this
    type of code and our company happily seems to accept code like the
    above with no spaces between the two characters.
    >
    Is the above code a real problem or not?
    >
    Yes, it is. Your particular compiler may add that feature as an
    extension, and it's also slated for C++0x, but it is not standard
    compliant code.

    Comment

    • asterisc

      #3
      Re: c++ primer statement about vectors containing vectors

      On Mar 26, 4:34 am, pauldepst...@at t.net wrote:
      C++ Primer by Lippman, Lajoie and Moo seems to object to code like
      std::vector<std ::vector<double >something;
      >
      The concern is that >will be interpreted as a shift operator and the
      code will not compile. However, I have seen no problems with this
      type of code and our company happily seems to accept code like the
      above with no spaces between the two characters.
      >
      Is the above code a real problem or not?
      >
      Thanks,
      >
      Paul Epstein
      Can you post the chapter and page where did you find that? (among with
      the edition of the book)

      I read that book and I remember they specified that you *have* to
      leave a white space between the two '>'. Maybe not in every
      occurrence, but they did it at least when they wrote
      std::vector<std ::vector<double for the first time.

      Comment

      • Shadowman

        #4
        Re: c++ primer statement about vectors containing vectors

        pauldepstein@at t.net wrote:
        C++ Primer by Lippman, Lajoie and Moo seems to object to code like
        std::vector<std ::vector<double >something;
        >
        The concern is that >will be interpreted as a shift operator and the
        code will not compile. However, I have seen no problems with this
        type of code and our company happily seems to accept code like the
        above with no spaces between the two characters.
        >
        Is the above code a real problem or not?
        >
        As stated elsethread, it's illegal without the whitespace according to
        the current standard, but that looks like it will change for the next
        standard. Here's an interesting relevant article from the standards
        committee:


        --
        SM
        rot13 for email

        Comment

        Working...